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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how do I fiter data in...
Power Apps
Answered

how do I fiter data in listbox control using filter

(0) ShareShare
ReportReport
Posted on by 55

Dear all,

 

I have a browsegallery1 with Items = SortByColumns(Search(Table1; TextSearchBox1.Text; "xxx1"); "xxx1"; If(SortDescending1; Descending; Ascending))

 

 Now I want to add a dropdown element in order to filter the results based on the user selection on the app.

 

Any Idea how can I handle this ?

 

Thanks a lot

Categories:
I have the same question (0)
  • hpkeong Profile Picture
    2,944 on at

    Hi @Antonio

     

    I have just replied to a post here, esp. on the part for Amit.

    https://powerusers.microsoft.com/t5/PowerApps-Forum/Multiple-Filters-not-working/m-p/10418#U10418

     

    Please cehck if this is OK for you.

     

    Have a nice day.

  • Antonio Profile Picture
    55 on at

    Hello Thanks a lot,

     

    I have modified the query to this :

    SortByColumns(Search(Filter(Table1;Dropdown1.Selected.Value in 'Table1Column'); TextSearchBox1.Text; "xxx1";"xx2";"xx3"); "xxx1"; If(SortDescending1; Descending; Ascending))

     

    and the filter is working.

    Now my issue is that the Gallery is pre-filtered , instead I would like to have the gallery filtered only when the user is using the Dropdown1 control.

     

    Thanks a lot for your support

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @Antonio,

     

    If what matters for you is using the dropdown and you don't need any pre-ordering or pre-filtering before picking an option or you are not using TextSearchBox, just get rid off SortByColumns() and TextSearchBox and use 

     

    Filter(Table1;Dropdown1.Selected.Value in 'Table1Column')

    or you can also build it like

     

    Filter(Table1; Table1Column = Dropdown1.Selected.Table1Column)

    works in both ways.

    This will just filter all the unordered data by your dropdown selection.

     

    Best regards.

  • hpkeong Profile Picture
    2,944 on at

    Hi @Antonio @Anonymous

     

    I copy and paste from the reply I posted for Ami. Hope this is clear.

    Hi @AmitLoh-Powerap

     

    Original Text:

    In PowerApps example (3-screens autogenerated apps), it always use

    - Sortby(Search(.............. Filter(..........)) where the Gallery.Items = TableX

     

    This is OK only for SINGLE Search!

     

    But, I always prefer to have several ways of searching, such as:

    - TextInput (as of MS example)

    - Sort by Dropdown

    - Sort All, Group, etc.

     

    In this case, you have to use:

    - Screen.OnVisible = ClearCollect(NewCollection, Filter(OriginalTable, Condition as you wish, ......)) if pre-filter needed, OR

                                      ClearCollect(NewCollection, OriginalTable)...If no pre-filter needed

    - Set the Gallery.Items = NewCollection

     

    Now you can have different kind of Seach, by always referring to this NewCollection.

    e.g.:

    1. ButtonAll.OnSelect = ClearCollect(NewCollection, OriginalTable)...whenver you want to revert back to view ALL

    2. InputText1.OnSelect or OnChange = ClearCollect(NewCollection, If(IsBlank(TextInput1.Text), OriginalTable, Filter(OriginalTable, FieldTitleZ = InputText1.Text)))

    3. DropDown.OnSelect or OnChange = ClearCollect(NewCollection, Filter(OriginalTable, FieldTitleX = or exactin or in Dropdown1.Selected.Result)), where the Dropdown can be Dropdown1.Items = Distinct(OriginalTable, FieldTitleX)

    4. Others where the syntax is identifical of Dropdown.

     

    You can observe here that: All Filtering, Dropdown, Input Text will eventually being ClearCollect ino NewCollection, where NewCollection is the items for Gallery.

     

    Learn Tutorial has never mentioned this method because it assumes that most of the time, we only fitler ONE WAY, but the logic is the same. I am sure you are aware of this but never try or maybe I am wrong.

     

    Hope this helps.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard