Skip to main content

Notifications

Community site session details

Community site session details

Session Id : usM2dkHLrROltj6KSEWru0
Power Automate - General Discussion
Unanswered

Compare two list rows/arrays to find differences

Like (0) ShareShare
ReportReport
Posted on 1 Dec 2022 16:19:20 by 90

I have data coming from two sources that I have in a select to map similar column names and would like to compare property values for each. Example is Col1 from excel is equal to Col1 of other target or not. 

1.png

I can do a compare by explicitly using a condition to compare each individual property but wondering if there is a better and less time consuming way. Especially if the number of properties here will be way more than just four. 

 

Any suggestions what would be the best way to accomplish this? Let me know please.

 

Thanks,
Raheel

 

@abm 

 

  • raoraheel Profile Picture
    90 on 05 Dec 2022 at 20:06:27
    Re: Compare two list rows/arrays to find differences

    @CFernandes kind of, yes. Below is the exact data that i'm trying to compare. If you look here, Value for Col3 is different in both arrays. What I am trying to achieve is to identify that Col3 has a different value. Does that make sense? Appreciate your time here. Thanks!

     

    Array 1:

    [
      {
        "Col1""No",
        "Col2""ValidateMasterData",
        "Col3""2",
        "Col4""No"
      }
    ]
     
     
    Array 2:
     
    [
      {
        "Col1""No",
        "Col2""ValidateMasterData",
        "Col3"0,
        "Col4""No"
      }
    ]
  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 05 Dec 2022 at 19:02:27
    Re: Compare two list rows/arrays to find differences

    Hey @raoraheel 

     

    Let me first see if I understand correctly - 

     

    Array 1 

     

    [
    "Clavin",
    "Fernandes",
    "Mano"
    ]

     

    Array 2

     

    [
    "Clavin",
    "Fernandes",
    "Balazs"
    ]

     

    Except Ouput -

     

    "Balazs"

     

    Is this what you need?

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

     

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 02 Dec 2022 at 15:11:43
    Re: Compare two list rows/arrays to find differences

    @raoraheel - I had done this last year(2021) - I will test and let you know early next week...

  • raoraheel Profile Picture
    90 on 01 Dec 2022 at 20:12:05
    Re: Compare two list rows/arrays to find differences

    @CFernandes I couldn't get it to work and can't seem to figure out what i'm doing wrong. 

     

    "inputs": {
            "from""@body('SelectParamValues')",
            "where""@not(contains(body('SelectExcelValues'), item()))"
        }
     
     
    This is the result of the filter array. My expectation is that Col3 is a mis-match and should be the only result.  Any thougts?
     
    2.png
  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 01 Dec 2022 at 19:17:57
    Re: Compare two list rows/arrays to find differences

    Hey @raoraheel 

     

    What about EXCEPT

     

    An Except clause will return the elements of the first Array that DO NOT APPEAR in the second Array. You can find details in the article https://www.damobird365.com/efficien-union-except-and-intersect-great-method/ 

     

    The idea would be to use a Filter Array - 

     

    CFernandes_0-1669922234892.png

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

  • raoraheel Profile Picture
    90 on 01 Dec 2022 at 18:43:01
    Re: Compare two list rows/arrays to find differences

    Hi @CFernandes , The intersection works and gets me values that match. What I would eventually like to see is non-matching values. So say reverse of intersection. 

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 01 Dec 2022 at 16:42:28
    Re: Compare two list rows/arrays to find differences

    Hey @raoraheel 

     

    Perhaps you are use  INTERSECT.

     

    The outcome of which is a list of ALL names that appear in BOTH lists but are not unique to either..

     

    OR use UNION - The outcome of which is a list of ALL names from BOTH lists.

     

    You can find some useful information at - https://www.damobird365.com/efficien-union-except-and-intersect-great-method/ 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
David_MA Profile Picture

David_MA 8 Super User 2025 Season 1

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

#3
ankit_singhal Profile Picture

ankit_singhal 7 Super User 2025 Season 1

Overall leaderboard
Loading started