cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lmheimendinger
Resolver III
Resolver III

Filter mixed conditions

I am pulling my hair out over what seems so simple, but what I am doing wrong evades me.

 

I need several different Filter() commands work.  The datasource is a SharePoint list, and a handful of columns are all Yes/No fields; let's call them A, B and C.  

 

If I want to Filter() on all records for A and C, then this works:

 

Filter(datasource,A=true, C=false)   although I expected Filter(datasource,A=true And C=false) to work but I get ALL the records in that case.

 

But here's what I also need:

 

Filter(datasource, (A=true Or B=true) And C=false)  or various true/false combinations.  In other words, how do I combine the Or and the And expressions?  I have tried things like Filter(datasource,(A=true Or B=true), C=false) and A=true And C=false Or B=true but nope.

 

I have reviewed the documentation for Filter as well as reading through gobs of posts, and the Or or And expressions are reported to work.  I was tickled when I tried just two conditions separated by a comma, but I haven't been able to extend that to three conditions, two And and one Or.

 

I am sure I will have a callous on my palm and a flat forehead when this is solved, as I slap my hand against my head: "I should have thought of that!"

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @lmheimendinger,

For and/or you need to bracket the "pairs" and also you do not need the true or false 

Filter(
   DataSource,
   A && (!B || C)
)

means A is true and either B is false or C is true, whereas this 

Filter(
   DataSource,
   (!A && B) || C
)

 means EITHER BOTH A is false AND B is true OR C is true.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
Jagadeeshk
Responsive Resident
Responsive Resident

Are you using yes/no complex column in sharepoint? If so instead of check true check 1.

Filter( datasource, and(A=1,C=0)). 

WarrenBelz
Super User
Super User

Hi @lmheimendinger,

For and/or you need to bracket the "pairs" and also you do not need the true or false 

Filter(
   DataSource,
   A && (!B || C)
)

means A is true and either B is false or C is true, whereas this 

Filter(
   DataSource,
   (!A && B) || C
)

 means EITHER BOTH A is false AND B is true OR C is true.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Warren

 

That worked!  Thanks.  I learned a few things:

 

  1.  I initially just used the column name, no =true/false but because that wasn't giving me the desired result, I ended up using the =.
  2. I I had the grouping right as well as the logic, but the expressions didn't work out.

Now all is well in my apps world.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,783)