Power Automate efficiently Filter Array with an OR criteria

Learn how to filter an array efficiently in a Power Automation Flow

In my previous post I have shown how filter an array in a Power Automate Flow with an OR criteria. While this implementation works, here is a much easier and better implementation.

Apply an OR filter criteria to your Power Automate Flow

The much easier flow looks like this:

It consists of the following steps:

  1. Manually trigger a flow: This is the trigger for the flow, I have chosen a manual trigger here. You can also start this e.g. when a Forms is submitted or a new entry is entered in a list
  2. Initialize variable PEOPLE: Initialization of the PEOPLE array variable to have some data to filter.
  3. Filter array starts with T OR M: Filter the array for all entries where the first name starts with T or with M

In detail the single steps look like this.

Initialize variable PEOPLE

The PEOPLE variable is initialized as an array with the content:

[
  {
    "firstname": "Test",
    "lastname": "Person"
  },
  {
    "firstname": "Max",
    "lastname": "Mustermann"
  },
  {
    "firstname": "John",
    "lastname": "Doe"
  }
]

Filter array starts with T OR M

For this step, select the Filter array element and put the PEOPLE array as From. Next you need switch from basic mode to advanced mode.

Now you need to replace the @equals('','') formula with @or(startsWith(item()?['firstname'], 'T'), startsWith(item()?['firstname'], 'M')).

That's it, save and test your Flow and see the result. You have implemented an OR criteria to filter an array in a Power Automate Flow in a fast and easy way!

Quick Tip

The advanced editor in the filter is very slow to type in and it can become very hard to defined complex criteria. An easy workaround is to use your favorite text editor to write the formula and then paste it in the field.