List.Union Function (Power Query M)

List.Union takes several lists and merges them into one, dropping the duplicates that appear across them. Available in Excel (Power Query), Power BI Desktop, and Power BI Service.

If you have two or more lists and you want a single combined list with no repeats spanning them, this is the function to use.

Syntax of List.Union Function

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

where

  • lists (required, list). A list of lists. You wrap the lists you want to merge inside one outer list, like List.Union({listA,listB}). This is the part people trip on the most.
  • equationCriteria (optional, any). Controls how two items are judged equal, for example Comparer.OrdinalIgnoreCase for case-insensitive matching. Omit it for the default exact, case-sensitive match.

Returns: a single list containing the items from all input lists, with duplicates that span the lists removed. The first occurrence is kept in left-to-right order.

In plain terms, you hand it a bunch of lists, and it returns one list where anything that showed up in more than one of them appears only once.

Example 1: Merge two lists of cities

You have two lists of cities and you want one combined list with no repeats.

let
Source = List.Union({{"London","Paris","Tokyo"},{"Tokyo","Berlin","Paris"}})
in
Source

Result: {"London", "Paris", "Tokyo", "Berlin"}

Tokyo and Paris appear in both lists, so they show up once. Notice both lists are wrapped inside one outer { }, which is the list of lists the function expects.

Example 2: Merge more than two lists

List.Union is not limited to two lists. Pass as many as you like inside the outer list.

let
Source = List.Union({{"A","B"},{"B","C"},{"C","D","A"}})
in
Source

Result: {"A", "B", "C", "D"}

Every value across the three lists is included, but each only once. The order follows where each value was first seen.

Example 3: Combine a column from two tables

A common real-world use is pulling one column from two different tables and merging the values.

Say the East region team owns one set of regions and the West team owns another, and you want the full list of regions covered, without repeats.

Here is the East team’s table:

Region
North
East
West

And here is the West team’s table:

Region
West
South
North

Pull the Region column from each table and union them:

let
Team1 = Excel.CurrentWorkbook(){[Name="EastRegions"]}[Content],
Team2 = Excel.CurrentWorkbook(){[Name="WestRegions"]}[Content],
Source = List.Union({Team1[Region],Team2[Region]})
in
Source

Team1[Region] and Team2[Region] each give you a list, and those two lists go inside the outer { }.

Result: {"North", "East", "West", "South"}

West and North are covered by both teams, so they appear once in the merged list.

Example 4: Duplicates within one list are kept

This is the surprising one. List.Union only removes duplicates that span the lists. Repeats that already sit inside a single input list are left alone.

let
Source = List.Union({{"apple","apple","banana"},{"banana","cherry","cherry"}})
in
Source

Result: {"apple", "apple", "banana", "cherry", "cherry"}

The two apple values were both in the first list, so they survive. Same for the two cherry values in the second list. Only banana, which spanned both lists, was collapsed to one.

Example 5: Make the union case-insensitive

By default the matching is case-sensitive, so Apple and APPLE count as different. Pass Comparer.OrdinalIgnoreCase to treat them as the same.

let
Source = List.Union({{"Apple","Banana"},{"APPLE","Cherry","banana"}},Comparer.OrdinalIgnoreCase)
in
Source

Result: {"Apple", "Banana", "Cherry"}

APPLE and banana are dropped as duplicates of Apple and Banana. The casing that wins is the first one seen, so the original Apple and Banana are kept.

Things to keep in mind with List.Union

  • The argument is a list of lists, not separate lists. Write List.Union({listA,listB}), never List.Union(listA,listB). Forgetting the outer { } is the most common mistake and gives you the wrong result or an error.
  • It uses bag semantics. Only cross-list duplicates collapse. Repeats inside a single input list are preserved (Example 4). If you also need to clean up repeats within a list, wrap the result in List.Distinct.
  • Order is deterministic and first-seen wins. Items come out in the order they were first encountered, left to right across the lists, so you can rely on the output order. If you want a specific order instead, run the result through List.Sort.
  • Matching is exact and type-exact by default. 1 (number) and "1" (text) are not equal, and casing matters. Use equationCriteria like Comparer.OrdinalIgnoreCase to relax case matching.

Common questions about List.Union

What is the difference between List.Union and List.Combine?

List.Combine concatenates the lists and keeps every item, including all the duplicates. List.Union merges them but removes the duplicates that span the lists. Reach for List.Combine when you want everything stacked together, and List.Union when you want the distinct set across the lists.

If you are working with whole tables instead of lists, Table.Combine appends the rows and keeps duplicates, while Table.Distinct strips repeated rows out afterward.

List of All Power Query Functions

Related Power Query Functions / Articles:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.