Remove Duplicates from a Power Automate Array with One Action

Power Automate Flow Examples Website Title

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.

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:

[ "", "", "", "", "", "", "", "" ]
Initialize Variable - Mailing List

As you can see, we have 3x and 2x, 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 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 my YouTube channel: