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 / Gallery filtering wron...
Power Apps
Answered

Gallery filtering wrong with dropdown boxes + collections

(0) ShareShare
ReportReport
Posted on by 158

Hello All, 

 

I have created 2 collections: colPartNumber and colMonth in OnVisible (Screen). I wanted to use them in filter boxes to see option "All". Filters should show option "All" and single distinct record from gallery in dropdown boxes. My gallery's source is excel file. I have no errors on formulas but gallery is filtering wrong.

 

On Dropdown1 where I have collection of all part numbers ("All") and distinct part number I can see correct information so showing me data but does not work on gallery so gallery is not filtering at all - nothing happens when I press part number or "All". 

 

On Dropdown2_4 where I have collection of all months ("All") and distinct month I cannot see anything when press dropdown box only blank lines. I press any blank line and it's working for instance I pressed second blank line and gallery filters through 1st month but for some reason doesn't work with "All" option as it should be the first line. 

 

Code for collections (Screen -> OnVisible):

ClearCollect(colPartNumber, {Result:"All"}, Distinct(Table10, 'PART NUMBER'));
ClearCollect(colMonth, {Result:"All"}, Distinct(Table10, month1));
Collect(colPartNumber, Distinct(Table10, 'PART NUMBER'));
Collect(colMonth, Distinct(Table10, month1))

 

Code for Gallery (Items):

If(
Dropdown1.Selected.Result="All" &&
Dropdown2_4.Selected.Result="All",
Filter(Table10, 'PART NUMBER'=Dropdown1.Selected.Result),
Filter(Table10, month1=Dropdown2_4.Selected.Result)
)

 

Codes for Dropdown boxes (Items):

colPartNumber

colMonth

 

Any ideas anyone, please? 

Thank You!

 

 

Categories:
I have the same question (0)
  • anibra Profile Picture
    278 on at

    Hi @marcy_pi ,

    if you want to show all the results of you table you don't need a filter. 

    If(
    Dropdown1.Selected.Result="All" &&
    Dropdown2_4.Selected.Result="All",
    Table10
    )

     

  • MP-13011217-0 Profile Picture
    158 on at

    Thank You but it still doesn't work on my gallery. 

  • anibra Profile Picture
    278 on at

    Are you getting any error?

  • MP-13011217-0 Profile Picture
    158 on at

    No there is no error, I just can't see any data in my gallery now. I can see options in Dropdown1, still blank lines in Dropdown2_4. Nothing in gallery. 

  • anibra Profile Picture
    278 on at

    In screen onVisible you need only Clearcollect()

    Code for collections (Screen -> OnVisible):

    ClearCollect(colPartNumber, {Result:"All"}, Distinct(Table10, 'PART NUMBER'));
    ClearCollect(colMonth, {Result:"All"}, Distinct(Table10, month1));

  • MP-13011217-0 Profile Picture
    158 on at

    Ok thank You now the option "All" is working but when I choose any other distinct value from Dropdowns different than "All" it just shows me nothing in the gallery - blank. 

  • anibra Profile Picture
    278 on at

    Than the items of the gallery should look like this:

     

    If(
    Dropdown1.Selected.Result="All" &&
    Dropdown2_4.Selected.Result="All",
    Table10,
    Dropdown1.Selected.Result <>"All",
    Filter(Table10, 'PART NUMBER'=Dropdown1.Selected.'PART NUMBER'),
    Dropdown2_4.Selected.Result<>"All",
    Filter(Table10, month1=Dropdown2_4.Selected.month1)
    )

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    Hi, try Dropdown1.SelectedText instead of Dropdown1.Selected

     

    Also, test these statements in labels, to make sure they return what you expect.

  • MP-13011217-0 Profile Picture
    158 on at

    Thank You! It's working almost ok... 

     

    Dropdown1 - when I choose any option it filters gallery fine. 

    Dropdown2_4 - when I choose any month it's working but only when Dropdown1 in selected on "All". If I pick any other number in Dropdown1 like P611252 and lets say month number 3, it will show me this below (so it won't show me all lines for month 3 but it will show me all lines for month 1 and 2): 

    marcy_pi_0-1654607466015.png

     

    ...also as You can see the values for month are there but not visible... while I have Visibility turned on and the text colour is black on white background. 

     

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    ok,

     

    Lets break it down to small bites.

     

    For the "white months", plese select the dropdown in your canvas an check the font color and related properties.

    volor.PNG

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard