OpenBI Docs Buy

List.Intersect

The values found in every one of several lists.

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

Syntax

List.Intersect(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 shared values, in the order of the first list.

Remarks

  • The lists are counted like bags: a value appears in the answer as often as in the list where it is least frequent.

Examples

Cities with both a shop and a warehouse

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

Two shops in Oslo, one warehouse

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

List.Union, List.Difference, List.ContainsAll.

Last updated · OpenBI Studio 0.3.79