Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

ODATA Filter Query with if expression

Hi, is it possible to use "if" expression in Filter Query? I want to add another parameter in the filter if the value is not empty/blank.


I am trying to add a "if" condition but I cannot update as the expression is invalid.

Any advise?

Impactful Individual
Impactful Individual

Hey, @sbgoh , is there a chance that you could pull the IF statement out of the expression and into a Condition action to feed a variable, and just use the variable in the ODATA?

Hi, I tried to use filter array in if condition but the filtering is not working. Do you have any sample for your solution?

Impactful Individual
Impactful Individual

Sorry, I'm not really sure where the Filter Array is coming from, @sbgoh , mate ... but just do the calculation that you're doing in the expression with flow actions, and have the result of the condition (or switch) set the value of whatever you need in the ODATA.


Does that make more sense?


Super User
Super User


You can't use an if() expression in the way you want in your filter. 



If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.


 Hi eliotcole,

I don't quite understand what you mean. My filters might be the following pt 1 & 2.


1. If I want to get the records for "Customer = ABC" with "Stage = Pending".

2. If the user leaves Customer = Blank, and Status = Pending, it means to retrieve All customers with pending status.


I am able to do pt 1 alone but I don't know how to combine pt 1 & 2. Any advise?

Not sure if it will help in your case but I have managed something similar to what you are trying to do.

At the beginning of my Flow I use the Initialize Variable (I would assume Compose may work as well) "if(contains(variables('InternalDomains'),variables('SenderDomain')),'Internal','External')"

Output would then be 'Internal' Or 'External'



In the ODATA query 
RecipientAddress eq '@{items('ForEachRecipient')}' and Internal_x002f_External eq '@{variables('InternalOrExternal')}'
The x002f is just a forward slash in the column name


I construct my filter query at PowerApps and got my problem solved.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,292)