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

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.

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

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,068)