Discovered a Power Automate Expression That's Worth Knowing!

intersection() compares two arrays and returns a new array containing only the values they have in common.

Example:
Array 1 — Constituent Codes: Individual, Board Member
Array 2 — Specific List: Trustee, Board Member
Result: Board Member

I'm nesting intersection() inside length() so I can use the result directly in a Conditional Control to determine whether the constituent has any of the codes I'm looking for:

length(intersection(variables('SpecificList'), body('SelectConstCodes'))

If the result is greater than 0, there's a match.

This method is so much better than looping through one of the arrays to compare each current value against the other one.

Answers

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Facilitator 5 Kudos 5 bbcon 2025 Attendee Badge

    Great post of tip.

    A few note as this expression is explored to be used:

    • intersection is case sensitive, so "John Smith", is not the same as "john smith"
    • intersection can work with an object, but it will look at every property in an object to find "common" item
      • not the same:
        [{"First":"Alex","Last":"Wong"}]
        [{"First":"Alex","Last":"wong"}]
      • in the context of RE NXT, your "get constituent code" will return additional data such as date_added, and date_modified, so you will need to do a "Select" operation to select the description of the constituent code first before doing an intersection.
    image.png

    I like using Filter Array action as it has less action but is a little harder to use with advanced mode filtering. Filter Array is also case-sensitive.

    image.png
  • Austen Brown
    Austen Brown Community All-Star
    Tenth Anniversary Kudos 5 August 2026 Monthly Challenge: Preparing for bbcon 2026 bbcon Attendee Badge

    Shared this at the August 2026 Power Automate User Group meeting. As requested, here's a sample of the intersection() expression in action. Pay attention to the "Read Me" compose at the top of the flow for the elements that need updating. Let me know if you have any questions.

Categories