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 / Comparing 2 Arrays to ...
Power Automate
Unanswered

Comparing 2 Arrays to Get Difference using Filter Array Not Working

(0) ShareShare
ReportReport
Posted on by 256

I am comparing 2 arrays that each contain an ID value. I am using the Filter Array method which uses the "does not contain" to get an output of values that are not within the other array. Both arrays contain exactly the same values, but it does not recognize them as being contained in the other array. I use this method all the time and was following a pattern that I already have in place that is working perfect. Can anyone notice anything here?

landonjochim_1-1707343063504.png

 

 

landonjochim_0-1707342997882.png

 

Categories:
I have the same question (0)
  • Manish Solanki Profile Picture
    15,109 Moderator on at

    Hi @landonjochim 

     

    Here is the sample flow that helps you in completing the filter operation.

     

    I have stored both input array in compose action:

    ManishSolanki_0-1707361882376.png

    [
    {
    "ID":100,
    "Title":"Title 100",
    "PrincipalID": 5
    },
    {
    "ID":101,
    "Title":"Title 101",
    "PrincipalID": 3
    },
    {
    "ID":102,
    "Title":"Title 102",
    "PrincipalID": 4
    }
    ]

    ManishSolanki_1-1707361921449.png

    [
    {
    "ID":100,
    "Title":"Title 100",
    "PrincipalID": 5
    },
    {
    "ID":101,
    "Title":"Title 101",
    "PrincipalID": 3
    },
    {
    "ID":102,
    "Title":"Title 102",
    "PrincipalID": 4
    }
    ]

     

    Next, add Select action to create a simple array of principalID which we will be required during filtering:

    ManishSolanki_2-1707362122699.png

    Click "Switch Map to text mode" button:

    ManishSolanki_3-1707362173627.png

    Add below expression in Map textbox to collect the value of PrincipalID:

    ManishSolanki_4-1707362282655.png

    item()?['PrincipalID']

     

    Finally, add filter array action. Pass the output of compose action (the input array which was not used in select action). 

    ManishSolanki_5-1707362428694.png

    Click 'Edit in advanced mode' button and write the below query:

    @not(contains(body('Select'), item()?['PrincipalID']))

    The output of filter array gives the resultant array.

     

     

    Output:

    ManishSolanki_6-1707362527028.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • landonjochim Profile Picture
    256 on at

    Yes that is exactly what I have setup in mine and it returns as both arrays are different. And nothing is contained in the other. makes no sense

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 86 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 55

#3
Ellis Karim Profile Picture

Ellis Karim 53 Super User 2026 Season 1

Last 30 days Overall leaderboard