Today, I will discuss an interesting example, and it is about filtering an array by another array in Power Automate. In this tutorial, I will show you how to filter an array with another array using the Power Automate Filter array action.
You can learn two different examples here, such as:
- Filtering an array with another array in Power Automate [Manually Created Arrays]
- Filtering two Excel arrays using Power Automate
Filter an Array with Another Array in Power Automate
For this example, let me create two array variables manually, where each variable stores an array of objects.
You can see the two arrays below in the code:
Course Details Array:
[
{
"CourseName": "Power Automate Essentials",
"CourseID": "CRS001",
"Technology": "Power Platform",
"Tutor": "Joseph David",
"StartDate": "2025-07-01"
},
{
"CourseName": "Introduction to SharePoint",
"CourseID": "CRS002",
"Technology": "SharePoint",
"Tutor": "Alex Wilber",
"StartDate": "2025-07-05"
},
{
"CourseName": "Azure Fundamentals",
"CourseID": "CRS003",
"Technology": "Azure",
"Tutor": "Jo Anne",
"StartDate": "2025-07-10"
},
{
"CourseName": "Power BI for Beginners",
"CourseID": "CRS004",
"Technology": "Power BI",
"Tutor": "John Mathews",
"StartDate": "2025-07-08"
}
]Enrolled Courses:
[
{
"StudentName": "Meera Patel",
"CourseID": "CRS003",
"Technology": "Azure"
},
{
"StudentName": "Nisha Rao",
"CourseID": "CRS002",
"Technology": "SharePoint"
}
]From these two arrays, I wanted to filter out students who were not enrolled in specific courses based on the Course ID. Therefore, the filter array should display the array values, excluding the course items that are not enrolled in.
We can achieve this by using the Filter Array action in Power Automate.
Here are the steps to do this:
- Let me create an Instant cloud flow in Power Automate.
- Then, add an ‘Initialize variable‘ action to set the array values in a variable. Provide a variable name, choose type as (Array), and value with an array of objects mentioned above.

- Next, take a Compose action, which will store the other array values, i.e., the students who are enrolled in courses.

- Following that, add a ‘Select‘ action to set the array of Course IDs from the students array to check the Course ID matches in the Course Details Array. Set the parameters given below.
- From: Choose the outputs of the Compose action.
- Map: Click on Switch to text mode -> Enter the expression below.
@{item()?['CourseID']}
Now, I want to filter an array [Course Details] with another array [Enrolled Courses], where the filtered items should return the array values for which students are not enrolled.
- For this, add a ‘Filter array‘ action to filter the Course IDs in both arrays. Set the required parameters below.
- From: Select the initialize variable output from the dynamic content.
- Filter Query: The query is placed in the table below.
| Choose Value | Operator | Choose Value |
|---|---|---|
| @{body(‘Select’)} | does not contain | @{item()?[‘CourseID’]} |

- To display the filtered array values, I will add the ‘Compose’ action. In the ‘Inputs’ parameter, select Body of Filter array from the dynamic content.

- Now, the flow is completed. To save the flow, click on the Save icon. Then run it manually.
Output:

That’s how you can filter an array of objects by another array using Power Automate.
Check out How to Filter an Array by String Values in Power Automate?
Filter Two Excel Arrays using Power Automate Filter Array
Suppose you have two Excel files that contain ‘Course details’ and ‘Enrolled Students’ details, who enrolled in a particular Technology in your SharePoint document library.
Course Details:

Enrolled Students:

In both the Excel sheets, I wanted to filter the Array of the Enrolled Student list, where Enrolled Technology matches the ‘Technology’ present in the Course Details Excel sheet. Based on the filtered items, update the ‘Course Status’ for the enrolled student.
Check out the steps mentioned below:
- I will create a Power Automate Instant cloud flow that updates all Excel rows with a single click of a button.
- To fetch the rows present in an Excel table of [Course Details], add the “List rows present in a table” action. Configure the parameters present in it.
- Location: Select the file location, such as SharePoint, OneDrive, or Groups, etc.
- Document Library: Choose the specific document library where the file is stored.
- File: Select a specific Excel file present in the library.
- Table: Add a table from the drop-down options.

- Then, add one more “List rows present in a table” action that will fetch records from the Enrolled Students Excel file. Set the parameters, such as Location, Document Library, File, and Table.

- Next, add a ‘Select’ action to set the array, which will be used for comparison in the Filter Array action.
- From: Take the body/value of the list rows present in the Excel table action [Enrolled Students].
- Map: Switch to text mode -> add Enrolled Technology column from dynamic content.

- Now, take a Filter array action to filter one Excel array by another Excel array. Configure the parameters.
- From: Add body/value from the dynamic content of [Course Details].
- Filter Query: Provide the query given in the table below.
| Choose Value | Operator | Choose Value |
|---|---|---|
| @{body(‘Select’)} | is equal to | @{item()?[‘Technology’]} |

- After that, add the ‘Apply to each loop‘ action. Select an output from previous steps to: Filter Array Body [@{body(‘Filter_array’)}].

- Inside the loop, take the ‘Update a row‘ action that updates each row each time the flow runs. Set all the required parameters.
- Location: Choose the Excel file location.
- Document Library: Select the SharePoint document library where the file is present.
- File: Select a File name from the drop-down.
- Table: Add the Table from the drop-down options.
- Key Column: To identify the row, we need to provide a Key Column that has a unique identifier for each row. In my case, it is Enrolled Technology.
- Key Value: Add the dynamic content of ‘Technology’ here.
- Course Status: Provide @{item()?[‘CourseStatus’]}.
Replace ‘CourseStatus’ with your Excel column name.

The flow is ready now. Save and test it.
Output:

This way, you can filter an array with another array using the Power Automate Filter array action.
You may also like the following Power Automate tutorials:
- Mention Multiple Users in a Microsoft Teams Message using Power Automate
- How to Filter an Array by Date in Power Automate?
- How to Filter an Array by Multiple Conditions in Power Automate?
- How to Filter an Array by Index in Power Automate?
- Filter Array in Power Automate Examples

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.