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
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.
intersection([<collection1>], [<collection2>], ...) intersection('<collection1>', '<collection2>', ...)
- 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 ..
- 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)) => 
How To Use The Power Automate Intersection Function
Follow the steps to use the Power Automate Intersection function in a flow.
Create a new flow with trigger ‘Manually trigger a flow’
Add a new step by clicking on ‘+ New step’
Add a new step
Search for ‘initialize’ and click on ‘Initialize variable’
Add Initialize variable action
Setup Initialize variable: 1) Provide a name, 2) select type Array, 3) Set value to ‘[1,2,3]’
Add a compose step by searching for ‘compose’ and clicking on ‘Compose’
Add Compose action
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’
Setup intersection expression in Power Automate
Save and do a test run
Result test run – Power Automate intersection function example