OpenBI Docs Buy

List.Union

Several lists put together so that a value they share isn't doubled, in the order the values first appear.

Group: List. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

List.Union(lists as list, optional equationCriteria as any) as list
ParameterTypeDescription
listslistA list of lists.
equationCriteriaany
optional
How two values count as equal: a comparer or a key function.

Returns

list. The values of the first list, then those of each next list that are not there yet.

Remarks

  • The lists are counted like bags: a value appears in the answer as often as in the list where it is most frequent. Two Oslos in one list and one in another give two; List.Distinct afterwards leaves one.

Examples

Every city with a shop or a warehouse

List.Union({{"Oslo", "Bergen"}, {"Bergen", "Tromsø"}})
{"Oslo", "Bergen", "Tromsø"}

A value twice in one list

List.Union({{"Oslo", "Oslo", "Bergen"}, {"Bergen"}})
{"Oslo", "Oslo", "Bergen"}

List.Intersect, List.Difference, List.Combine, List.Distinct.

Last updated · OpenBI Studio 0.3.79