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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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