How to remove duplicates from an array in Power Automate
Use the union() expression with the same array twice, such as union(variables('Emails'), variables('Emails')). The result keeps one copy of each value.
Why does union() remove duplicates?
The union() function returns one collection that holds every item from the collections you pass in. An item that appears in more than one collection shows up once in the result.
Microsoft shows this in its expression reference: union(createArray(1, 2, 3), createArray(1, 2, 10, 101)) returns [1, 2, 3, 10, 101]. The values 1 and 2 appear in both arrays but come back once. When you pass the same array twice, the result is that array with each value listed once.
How do you remove duplicates from a list of text values?
- Add a Compose action, or a Set variable action, after the step that builds your array.
- Select the Expression tab in the input box.
- Type union(outputs('Array'), outputs('Array')). Replace Array with the name of your action.
- Select Add, then save and run the flow.
- Open the run history. The output holds each value once.
How do you remove duplicates from SharePoint column values?
A Get items action returns objects, not plain text. Each object has many fields, so two rows are almost never identical. Run a Select action first and map one column, such as the customer name, in text mode.
Then use union() on the Select output. See our guide on the Select action. If Get items stops at 100 rows, see Get items returning only 100 items.
Why do values like Smith and smith both stay in the result?
Text comparison in union() treats upper and lower case as different. To merge them, change the case in the Select step. Map toLower(item()?['Title']) instead of the raw column, then run union().
Trim extra spaces the same way: toLower(trim(item()?['Title'])).
Can you combine the result with other actions?
Yes. Put the unique list into a Join action to build one text string. Use a Filter array action before union() when you want only some values.
To count the unique values, wrap the result in length(). For example, length(union(outputs('Array'), outputs('Array'))) returns the number of different values.
FAQ
Is there a Remove duplicates action in Power Automate?
No. Use the union() expression with the same array twice.
Does union() keep the original order?
Check your own output in run history. Do not rely on a fixed order. Sort the result if the order matters.
Does union() work on arrays of objects?
Use it on text or number arrays. For objects, map one field with Select first, then run union().