web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at
    Re: Comparing 2 Arrays to Get Difference using Filter Array Not Working

    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
    Re: Comparing 2 Arrays to Get Difference using Filter Array Not Working

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard