Filter array in Power Automate
Filter array in Power Automate
When you’re dealing with large datasets in Power Automate, you often need to isolate the information that matters. The Filter array in Power Automate is a powerful tool that allows you to filter collections of items based on specific conditionsโwithout using loops.
This guide explores how to use the Filter array action effectively, with real-world examples, expression tips, and best practices to build optimized, reliable flows.
๐ Table of Contents
- Introduction
- What Is the Filter Array Action in Power Automate?
- Why Use Filter Array in Power Automate
- Input Requirements
- How to Use Filter Array (Step-by-Step)
- Common Filter Expressions
- Real-World Use Cases
- Filter Array vs Condition vs Select
- Best Practices
- Common Mistakes and Fixes
- Summary
๐งพ What Is the Filter Array Action in Power Automate?
The Filter array action is part of the Data Operations connector. It allows you to:
- Filter an array of objects based on one or more conditions
- Return only matching items
- Chain with other actions like Select, Apply to Each, or Compose
This is especially useful when working with data from SharePoint, APIs, Excel, or JSON responses.
๐ก Why Use Filter Array in Power Automate?
You should use Filter array in Power Automate to:
- Reduce unnecessary data early in the flow
- Avoid looping over irrelevant records
- Make flows faster and more readable
- Prepare clean data for later steps (email, export, APIs)
- Improve error handling by pre-validating input data
๐ฅ Input Requirements
To use Filter array, you need:
Requirement | Details |
---|---|
From | A valid array of objects (e.g., body('Get_items')?['value'] ) |
Condition | A logical expression (e.g., item()?['Status'] equals Completed ) |
If the input is not an array, the action will fail.
โ๏ธ How to Use Filter Array in Power Automate (Step-by-Step)
๐น Step 1: Add the Action
- Click + New step โ Data Operations โ Filter array
๐น Step 2: Set the โFromโ Field
- Use an array source:
Example:value
from Get items, orbody('Parse_JSON')?['data']
๐น Step 3: Define the Filter Condition
- Choose a field from the array
- Select an operator (
equals
,contains
,greater than
, etc.) - Enter the value to match
Example:
item()?['Status']
equalsCompleted
๐น Step 4: Use Filtered Output
- Use in Apply to each, Select, or Compose to act on clean data
๐งฎ Common Filter Expressions
Here are sample expressions used in Filter array in Power Automate:
Goal | Expression |
---|---|
Status is Completed | item()?['Status'] = Completed |
Amount > 100 | item()?['Amount'] > 100 |
Email contains “@gmail.com” | contains(item()?['Email'], '@gmail.com') |
Date is today | item()?['Created'] = utcNow() |
Field is not empty | not(empty(item()?['FieldName'])) |
Multiple conditions | @and(equals(item()?['Status'], 'Open'), greater(item()?['Amount'], 50)) |
๐ผ Real-World Use Cases
Use Case | Scenario |
---|---|
SharePoint Filtering | Filter only tasks where status = โIn Progressโ |
API Result Cleanup | Remove items with null values from a webhook |
Excel Automation | Extract rows where DueDate is less than today |
Approval Workflows | Send emails only for high-priority requests |
Email Parsing | Only retain emails marked as โImportantโ |
๐ Filter Array vs Condition vs Select
Feature | Filter Array | Condition | Select |
---|---|---|---|
Filters arrays | โ | โ | โ |
Stops processing | โ | โ | โ |
Remaps structure | โ | โ | โ |
Best for data prep | โ | โ | โ |
Filter array is ideal when you want to keep only certain items from a dataset.
โ Best Practices for Filter Array in Power Automate
- โ
Use
item()?['Field']
for null-safe access - โ
Use expressions for complex logic (
and
,or
,not
, etc.) - โ Test with sample data using Compose
- โ Limit returned columns with Select after filtering
- โ
Use
empty()
to avoid errors on missing fields
โ ๏ธ Common Mistakes and Fixes
Problem | Solution |
---|---|
Action fails | Ensure input is a valid array |
Null field errors | Use item()?['Field'] instead of item()['Field'] |
Wrong data type | Use int() , float() , string() to convert types |
Filtered nothing | Check field names โ they are case-sensitive |
Using Filter array instead of Condition |
Use Condition when flow logic must branch |
๐งพ Summary: Mastering Filter Array in Power Automate
The Filter array in Power Automate action is one of the most versatile tools for refining your data before use. It simplifies logic, improves performance, and reduces errors by working only with relevant items.
โ
Use it to filter SharePoint data, JSON from APIs, Excel rows, or any collection
โ
Combine it with Select, Compose, and Apply to each
โ
Follow best practices for cleaner, safer flows