Remove Duplicates From Power Automate Array Formula
You can remove the duplicates from a Power Automate array in two easy steps: add a Compose action and insert a Union function. The Union function combines two arrays together and returns only unique items.
Example #1: Remove Duplicate Emails From An Array
This Power Automate code shows how to remove the duplicate emails from an array.
Code
EmailsArray variable:
[
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
Union function code:
union(variables('EmailsArray'),variables('EmailsArray'))
Result
Example #2: Remove The Duplicate User Records From An Array
This Power Automate code shows how to remove the duplicate user records from an array.
Code
UserArray variable:
[
{"ID": 1, "Email": "[email protected]"},
{"ID": 2, "Email": "[email protected]"},
{"ID": 1, "Email": "[email protected]"},
{"ID": 3, "Email": "[email protected]"},
{"ID": 4, "Email": "[email protected]"},
{"ID": 2, "Email": "[email protected]"}
]
Union function code:
union(variables('UsersArray'),variables('UsersArray'))
Result
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
Questions?
If you have any questions or feedback about Remove Duplicates From Power Automate Array Formula please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
I love the union way – but sometimes we just want to combine 2 arrays or so. I’ve find out a way how to combine 2 arrays without removing duplicates = https://lehmann.ws/2023/01/31/powerplatformtip-24-merge-arrays-or-tables/
Marcel,
Thank you for sharing. The purpose of this article is to show how to get the unique values from an array column OR the unique rows. When your goal is to combine two or more arrays you would not want to use Union() since it removes the duplicates. It behaves similar to a SQL Union operation.
I have an array with members in a M365 Group, UPN and officeLocation. Now I want to remove duplicates in the officeLocation column so that I one get one employee from each officeLocation. How can I do that?