Remove Duplicates From Power Automate Array Formula

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





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.

Matthew Devaney

Subscribe
Notify of
guest

3 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Marcel Lehman
3 months ago

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/

Ola Henningssson
Ola Henningssson
28 days ago

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?