Skip to main content

Union

Learn how to union or merge data.

Two collections can be merged together using Collection.Union. Two lists can be merged together using List.Union.

These functions behave similarly: they takes two or more collections as parameters and concatenates them into one.

In the example, two datasets - one with summer olympic games data and another with winter olympic games data - are merged and then queried as if they were a single one. This allows users to see data from both olympic games as if they were a single dataset.

let summer = Csv.InferAndRead("https://raw-tutorial.s3.eu-west-1.amazonaws.com/summer_olympics.csv"),
winter = Csv.InferAndRead("https://raw-tutorial.s3.eu-west-1.amazonaws.com/winter_olympics.csv"),
olympics = Collection.Union(summer, winter)
in ...
info

If you want to try this example, you can deploy the following endpoint:

Tutorial 5 - Merging two collections
Learn how to merge two datasets.

Sample usage:

/tutorial/5-merge?country=<string>&year=<int>

For instance, to merge both summer and winter olympics for France for the year of 1992:

/tutorial/5-merge?country=FRA&year=1992