List.Union Function in Power Query

The List.Union function returns a list from a list of lists and unions the items in the individual lists. The returned list contains all items in any input lists. In this function at the time of merging the lists the duplicates are removed. It is different from the List.Combine function where at the time of merging the list the duplicates are retained.

Syntax

List.Union(lists as list, optional equationCriteria as any) as list

The function has the following parameters:
• lists: A list of lists to be combined.
• equationCriteria (Optional): Specifies how to compare values for duplicates (e.g., case sensitivity). Defaults to Comparer.Ordinal (case-sensitive).

Example: Create a union of list in power query.

Power Query M

let
  list1  = {"Ashish", "Esha", "Katrina"},
  list2  = {"Samyukta", "Esha", "Jennifer"},
  list3  = {"Alia", "Warina", "Katrina"}, 
  return = List.Union({list1, list2, list3})
in
  return 

The output of the above code is shown below:

List.Union function in Power Query

Comparison to Related Functions The following are some related functions:

List FunctionBehavior
List.UnionCombines lists and removes duplicates.
List.CombineCombines lists without removing duplicates.
List.DistinctRemoves duplicates from a single list.
List.IntersectReturns common values between lists.