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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,517)