Power Automate Intersection Function Explained

Power Automate Intersection Function

The Power Automate Intersection function generates a collection containing only items that are present in all the specified collections. The item that appears last with a certain name will be included in the result if it appears in all the collections passed to the function.

In case you want to create a collection that merges multiple collections without duplicates, take a look at the Power Automate union function.

In this article, I’ll introduce you to the intersection function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Intersection Function

Power Automate Intersection expression
intersection expression in Power Automate

Return a collection of items that are present in all specified collections. The final result only includes items that appear in every collection passed to the function. If duplicates exist, the last occurrence of an item will appear in the result.

Syntax

intersection([<collection1>], [<collection2>], ...)
intersection('<collection1>', '<collection2>', ...)

Input parameters

  • collection1 (mandatory): The first collection which elements should be used to create a new collection with all elements that are in all given collections.
  • collection2 (mandatory): The second collection which elements should be used to create a new collection with all elements that are in all given collections.
  • collection3 ..

Return value

  • Returns a collection: Create a collection containing only items that are present in all the specified collections.

Power Automate Intersection Expression Example

intersection(createArray(1,2),createArray(2,3))
=> [2]

How To Use The Power Automate Intersection Function

Follow the steps to use the Power Automate Intersection function in a flow.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    Power Automate Intersection Function new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    Power Automate Intersection Function new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    Power Automate Intersection Function initialize variable

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name, 2) select type Array, 3) Set value to ‘[1,2,3]’

    Power Automate Intersection Function setup initialize variable

    Setup variable

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    Power Automate Intersection Function add compose

    Add Compose action

  6. Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expression’, 3) set expression to ‘intersection(variables(‘col1’),createArray(2,3,4))’ 4) click on ‘OK’

    Power Automate Intersection

    Setup intersection expression in Power Automate

  7. Save and do a test run

    Power Automate Intersection Function result test run

    Result test run – Power Automate intersection function example

Leave a Comment

Your email address will not be published. Required fields are marked *