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

Combining multiple conditions on filtering browse gallery

Hi everyone,

I am helped on the following and is working very well indeed.

Sort( Filter( 'My List', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1
.Selected.Value ), Date, Descending )

Now I want to also include additional filter as :

Dropdown4 selection as "Closed"  ( It has tow selections "Open" & "Closed") This dropdown is on the gallery itself 

 

I tried but no success yet.

Any help please.

Thanks

Regards

 

4 ACCEPTED SOLUTIONS

Accepted Solutions
CNT
Community Champion
Community Champion

@K369 Try this,

Sort( Filter( 'My List', (IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1
.Selected.Value) && Dropdown4.Selected.Value="Closed" ), Date, Descending )

View solution in original post

proxyprochy
Resolver I
Resolver I

This is a tough one due to the delegation issues.

 

You can add multiple filters into the Filter() function simply by separating them with ,

 

But there's the problem with delegation. Not so nice (but working) solution would be to move all (If, IsBlank, IsMatch, ...) functions outside of the Filter().

 

the one with delegation problems:

Example:

 

Sort( Filter( 'My List', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1
.Selected.Value

//there goes the separator for the next filter

,

Location.Value = "hello world"), Date, Descending )

 

without the delegation problems:

Example:

(I'm sorry I'm too confused about applying it to someone else's list so I hope my picture would help you to imagine how tough these codes are:)

proxyprochy_0-1624267336843.png

I've done this for 5 filters and the rows count of this code is 128.

proxyprochy_1-1624267441229.png

Basically.. You have to get all the combinations outside of the Filter() function to get rid of the ,,delegation triangle"

View solution in original post

hello,

 

What errors exactly?

 

Can you show us the code you are using?

View solution in original post

Hello Proxyprochy

Thanks. Following is the information:

Original- Works well

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ), Date, Descending )

---------------------------------------------------------------------------------------------------------------

Modified with errors

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ) && Dropdown2.Selected.Value="Closed" ), Date, Descending )

 

Errors:

Invalid argument type. Expecting one of the following: Boolean, Number, Text, OptionSetValue

Invalid number of arguments: Received 1, Expected 2-3

View solution in original post

10 REPLIES 10
CNT
Community Champion
Community Champion

@K369 Try this,

Sort( Filter( 'My List', (IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1
.Selected.Value) && Dropdown4.Selected.Value="Closed" ), Date, Descending )

View solution in original post

proxyprochy
Resolver I
Resolver I

This is a tough one due to the delegation issues.

 

You can add multiple filters into the Filter() function simply by separating them with ,

 

But there's the problem with delegation. Not so nice (but working) solution would be to move all (If, IsBlank, IsMatch, ...) functions outside of the Filter().

 

the one with delegation problems:

Example:

 

Sort( Filter( 'My List', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1
.Selected.Value

//there goes the separator for the next filter

,

Location.Value = "hello world"), Date, Descending )

 

without the delegation problems:

Example:

(I'm sorry I'm too confused about applying it to someone else's list so I hope my picture would help you to imagine how tough these codes are:)

proxyprochy_0-1624267336843.png

I've done this for 5 filters and the rows count of this code is 128.

proxyprochy_1-1624267441229.png

Basically.. You have to get all the combinations outside of the Filter() function to get rid of the ,,delegation triangle"

View solution in original post

K369
Resolver II
Resolver II

Hello all,

Apologies for a late reply  as I was trying a lot with your kind suggestions:

CNT - It gives errors and can not figure out why... Still trying.

 

Hello proxyprochy

Apologies for a late reply as I was trying to understand and apply your solution, however giving me errors. Still trying 

hello,

 

What errors exactly?

 

Can you show us the code you are using?

View solution in original post

Hello Proxyprochy

Thanks. Following is the information:

Original- Works well

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ), Date, Descending )

---------------------------------------------------------------------------------------------------------------

Modified with errors

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ) && Dropdown2.Selected.Value="Closed" ), Date, Descending )

 

Errors:

Invalid argument type. Expecting one of the following: Boolean, Number, Text, OptionSetValue

Invalid number of arguments: Received 1, Expected 2-3

View solution in original post

K369
Resolver II
Resolver II

Hello CNT,

Thanks. Using solution suggested following is the information:

Original- Works well

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ), Date, Descending )

---------------------------------------------------------------------------------------------------------------

Modified with errors

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value ) && Dropdown2.Selected.Value="Closed" ), Date, Descending )

 

Errors:

Invalid argument type. Expecting one of the following: Boolean, Number, Text, OptionSetValue

Invalid number of arguments: Received 1, Expected 2-3

Just check your brackets.

 

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value && Dropdown2.Selected.Value="Closed" ), Date, Descending )

 

btw:

I have no idea what the hell are you trying to achieve and this should not work. Check this first:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

Hello Proxiprochy & CNT,

I have now tried both solutions and they work well. Very grateful indeed. 

Solution1:

Sort( Filter( 'MyList', IsBlank(Dropdown1.Selected.Value) || Location.Value = Dropdown1

.Selected.Value && Dropdown2.Selected.Value="Closed" ), Date, Descending )

 

Works well, however when I select a blank on Dropdown1, where it should get all records and then filter based on dropdown2 is not happening. There are no errors. But is not filtering based on dropdown2 if dropdown1 is selected blank.

 

Solution2:

without the delegation problems:

Yes its working well , but here if I select blank on dropdown1 then the screen is blank. Here If I could get all records displayed and filtered by Dropdown2.

 

You both are right. I was making mistakes in brackets 🙄

 

This is the las reply and question before I close this one and I will click on solution accepted.

Thank you very much again

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,083)