When working with data in Power Automate, you often need to combine, filter, or compare lists dynamically. The union, except, and intersect functions help you achieve that efficiently. Let’s break down how each works with basic examples.
1. Union: Merging Two Lists
The union
function combines two arrays and removes duplicates. It’s useful when you need to merge data from different sources into one list.
Example: Merging Two Lists of Names
Imagine you have two lists:
- List A:
["Alice", "Bob", "Charlie"]
- List B:
["Charlie", "David", "Emma"]
Using the union
function:
union(
["Alice", "Bob", "Charlie"],
["Charlie", "David", "Emma"]
)
union(varListA, VarListB)
Output:
["Alice", "Bob", "Charlie", "David", "Emma"]
👉 Duplicates are removed automatically!
2. Except: Finding Differences Between Lists
The except
function returns values from the first list that don’t exist in the second list.
Example: Finding Unique Names in List A
Using the same lists:
except(
["Alice", "Bob", "Charlie"],
["Charlie", "David", "Emma"]
)
except(varListA, VarListB)
Output:
["Alice", "Bob"]
👉 Only names from List A that are NOT in List B appear.
3. Intersect: Finding Common Values
The intersect
function returns only the values that exist in both lists.
Example: Finding Common Names
intersect(
["Alice", "Bob", "Charlie"],
["Charlie", "David", "Emma"]
)
intersect(varListA, VarListB)
Output:
["Charlie"]
👉 This helps when you need to find matching records in two datasets.