cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JAYates1995
Frequent Visitor

Filtering a gallery using 2 filters

I am very new to powerapps and am trying to create a way to browse a sharepoint list within an app. At the minute I have a filter set so users can search keywords in the title of items in the list however I would also like to have a dropdown where users can filter using categories. At the moment I can only figure out how to have one filter. Is there a way to filter the gallery using the text search box first but if that is empty then to filter via the dropdown? 

 

Below is the formula I am currently using to filter using the "title" as the logical  test :-

 

SortByColumns(Filter([@'Frequently Asked Questions'],Text(TextSearchBox1) in Title) , "Title", If(SortDescending1, Descending, Ascending))

 

thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions
AMoon
Advocate I
Advocate I

There are multiple different ways to combine filters and searches but the most direct answer to your question is that you can have an If statement that checks to see if the search box is blank - and if so then uses a different formula. 

 

If(IsBlank(TextSearchBox1.Text),
//use the category filter

SortByColumns(Filter([@'Frequently Asked Questions'],Category = Category.Selected *you need to fill this in* , "Title", If(SortDescending1, Descending, Ascending)),

//use the search 

SortByColumns(Filter([@'Frequently Asked Questions'],Text(TextSearchBox1) in Title) , "Title", If(SortDescending1, Descending, Ascending))

)

View solution in original post

2 REPLIES 2
AMoon
Advocate I
Advocate I

There are multiple different ways to combine filters and searches but the most direct answer to your question is that you can have an If statement that checks to see if the search box is blank - and if so then uses a different formula. 

 

If(IsBlank(TextSearchBox1.Text),
//use the category filter

SortByColumns(Filter([@'Frequently Asked Questions'],Category = Category.Selected *you need to fill this in* , "Title", If(SortDescending1, Descending, Ascending)),

//use the search 

SortByColumns(Filter([@'Frequently Asked Questions'],Text(TextSearchBox1) in Title) , "Title", If(SortDescending1, Descending, Ascending))

)

View solution in original post

v-qiaqi-msft
Community Support
Community Support

Hi@JAYates1995,

Based on the issue that you mentioned, do you wants to filter the gallery based on the search box first, then have another filter based on the Dropdown?

I have a test on my side, please modify your formula as below.

SortByColumns(
    Filter(
        Filter(
            [@'Frequently Asked Questions'],
            Text(TextSearchBox1) in Title
        ),
        Category.Value = Dropdown1.Selected.Value
    ),
    "Title",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

 

Best Regards,

Qi

Best Regards,
Qi

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,864)