web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need to remove duplica...
Power Automate
Answered

Need to remove duplicates from output of applytoeach list

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Capture.PNG

in the above screen shot in the Compose 2 action named region - I am getting list of regions but contains duplicates.

I have to remove duplicates.

In one of the post it was said to remove duplicates use union on some variable.

I tried to do but . I tried adding Append to array variable but when I click on Name drop down list I don't see any.

what name I have to choose?

where should I initialize the variable.

It seems I can't initialize in ApplyToEach, I can only use append array variable.

Any help ?

Categories:
I have the same question (0)
  • DeepakS Profile Picture
    2,301 Most Valuable Professional on at

    Hi @ShivaPatpi 

     

    Here is an example Power Automate to remove duplicates form an Array:

    Duplicate.png

     

    ——————————————————
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • RobElliott Profile Picture
    10,505 Super User 2026 Season 1 on at

    @ShivaPatpi or you can just use a Union expression which strips out duplicates from the 2 variables:

    union(variables('varTown'),variables('varTownCounty'))

    1-Append.png

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @ShivaPatpi ,

     

    You could first append all regions to an array variable and then use the union() function to remove duplicate elements from the array.

    Finally, you could use the Join action to extract regions.

    Image reference:

    80.PNG

     

    Best Regards,

  • ShivaPatpi Profile Picture
    Microsoft Employee on at

    @v-bacao-msft  , what will be the Join with value ?

  • ShivaPatpi Profile Picture
    Microsoft Employee on at

     Capture.PNG

    What should be the Join With ???

  • ShivaPatpi Profile Picture
    Microsoft Employee on at

     Capture.PNG

    Also i am getting above error when i try to add Append to array variable

  • Verified answer
    ShivaPatpi Profile Picture
    Microsoft Employee on at

    i was able to figure it out. I was self referencing the same variable twice in the for each loop which was going in a cycle.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 470

#2
Haque Profile Picture

Haque 416

#3
David_MA Profile Picture

David_MA 344 Super User 2026 Season 1

Last 30 days Overall leaderboard