Remove Duplicates from a Power Automate Array with One Action

Power Automate - Functions

So you have an array in Power Automate with duplicates, what is the easiest way to remove these duplicates? This blog post will show you how easy it is to do in a single action, there’s a video guide and a text-based walkthrough below.

Video:

Walkthrough:

Firstly, I’m assuming you already have your array, for my example I’ll be using email addresses for a mailing list which contains duplicates. The array is shown below:

[ "joe@contoso.com", "jax@constoso.com", "flowjoe@contoso.com", "sarah@contoso.com", "joe@contoso.com", "meg@constoso.com", "flowjoe@contoso.com", "joe@contoso.com" ]
Initialize Variable - Mailing List

As you can see, we have 3x joe@contoso.com and 2x flowjoe@contoso.com, we want to remove these duplicates and just have individual emails for our mailing list.

So how do we remove these duplicates quickly, efficiently and easily? We can simply use a Compose action and the Union function. While using the Union function we pass the same array into it twice. This causes Power Automate to think we’re merging two arrays (even though it’s the same array!) and removes the duplicates. This then leaves us with a final, duplicate free array, from the output of the compose action.

Compose - Get Array Without Duplicates Example

The Union code in this instance is:

union(variables('Emails'),variables('Emails'))
Union Function Example

Now lets take a look at what the output is after the flow has run:

Compose - Get Array Without Duplicates Completed

And there you have it, an array without duplicates using a single action and a single function.

If you’re looking to learn more about Power Automate functions, like the Union function used in this post, you can use then check this blog post list out: Power Automate Functions

Alternatively if you’re looking for videos to explain functions on Power Automate, check out and subscribe to my YouTube channel: https://youtube.com/c/FlowJoeVideos