web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter list by dropdow...
Power Apps
Answered

Filter list by dropdown and search box

(0) ShareShare
ReportReport
Posted on by 32

I have a gallery that has a dropdown filter and a search box and I'd like to be able to use both. I can get one or the other working, depending on the formula.

 

Search box (default)

SortByColumns(Filter(Trials, StartsWith(Title, TextSearchBox1_1.Text)), "Title", If(SortDescending1, Descending, Ascending))

Dropdown filter:

IF(Dropdown1.Selected.Value = "All Sites", Trials, Filter (Trials, Foundry.Value = Dropdown1.Selected.Value))

 

I'm having a hard time combining two formulas into one usable formula. I found some similar threads but couldn't apply them specifically to what I was going for.

 

Thank you

Categories:
I have the same question (0)
  • Verified answer
    tchin-nin Profile Picture
    779 on at

    Hi @Jensen

    You can try something like this to combined the 2 formulas :

    SortByColumns(Filter(Trials, StartsWith(Title, TextSearchBox1_1.Text) && (Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value) ), "Title", If(SortDescending1, Descending, Ascending))

    If "All sitess" is selected, the second condition is true so no need to filter the Foundry.Value. 

    But if it's false, then the filter on foundry will operate. 

     

    Théo

  • Verified answer
    KroonOfficeSol Profile Picture
    587 on at

    @Jensen

     

    @tchin-nin is right, you should do it as he said.

     

    You could also do it like this (I find it easier to read):

    SortByColumns(
    	Filter(Trials, 
    		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
    		Dropdown1.Selected.Value="All sites" || Foundry.Value = Dropdown1.Selected.Value
    	)
    	, "Title"
    	, If(SortDescending1, Descending, Ascending)
    )

    You could also drop the DropDown and change to a ComboBox. A combobox can be with no selection. The formula then becomes like:

    SortByColumns(
    	Filter(Trials, 
    		IsBlank(TextSearchBox1_1.Text) || StartsWith(Title, TextSearchBox1_1.Text),
    		IsBlank(ComboBox.Selected.Value) || Foundry.Value = ComboBox.Selected.Value
    	)
    	, "Title"
    	, If(SortDescending1, Descending, Ascending)
    )

    Hope this helps,

     

    Paul

  • Jensen Profile Picture
    32 on at

    These work great, thank you very much!

  • Jensen Profile Picture
    32 on at

    @KroonOfficeSol

     

    What would I need to add to get a second dropdown filter to work with this?

  • KroonOfficeSol Profile Picture
    587 on at

    @Jensen

     

    Just add a comma and an extra line like the other dropdown. This one

    Dropdown2.Selected.Value="All sites" || SecondField.Value = Dropdown2.Selected.Value


    You can add as many you like.

     

    Paul

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard