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 / Filtering a Gallery
Power Apps
Answered

Filtering a Gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

DropdownStudents.jpg

I have a SharePoint List called Students. The dropdown is a distinct list of the Students' Names. 

 

How can I have the dropdown:

 

1) Make the gallery show all of the students when the dropdown is Blank?

2) Show only the student that has been selected?

 

Thanks!!!

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    You mentioned that you have a DropDown with the Distinct student names, but you also mention "blank" - how is it that you are accomplishing that?  I'm going to go with the thought that perhaps you don't have that worked out yet and will describe the solution you are looking for.

     

    First, you will need a list of distinct names with some indicator that will uniquely identify "All"...so, we'll use "All"

    In your OnVisible (or some other place where you will execute a formula) you will need to build a collection for the DropDown.  There is no way (that I know of) to build the collection in the DropDown and add the option we want.  So:

    OnVisible

    ClearCollect(studentNames, {Result:"All"}); Collect(studentNames, Distinct(yourDataSource, studentNameField))

     

     

    Now, set the Items property of your DropDown to the collection - studentNames

    You will now have a dropdown with all the distinct student names in it and there will be (first in the list) "All".

    Then, for your Gallery, set the Items property as follows:

    Filter(yourDataSource, studentNameField=If(yourDropDown.Selected.Value="All", studentNameField, yourDropDown.Selected.Value))

    This will give you the results you are looking for.

     

    Hope this helps get you going.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes  So far, so good!!! However, when I created a reset button to reset the dropdown, it resets to Blank and then none of the items display in my gallery. Any idea how to reset it to the first option (All)?

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Excellent!!  Now for that default value on the DropDown...set the Default property to "All"

    Since this is a simple list you are providing to the DropDown, that will do the trick. 

     

    Hope that gives you a home run!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard