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 / Filter for Gallery Sel...
Power Apps
Answered

Filter for Gallery Selects Every Other Item when Loading

(0) ShareShare
ReportReport
Posted on by 232

Hello All,

 

I have a Gallery that I am filtering by location using a ComboBox. When I select the first location the gallery changes to that location but does not auto-select the gallery item. I select the second location and it auto-selects the gallery item. How can I get it to always auto select the first item after I have selected a location from the ComboBox. Formulas I am using are below:

 

ComboBox Filter Item:

Distinct(Sharepoint,Location)

 

Gallery Item:

Filter(
 Sharepoint,
 Location = ComboBoxFilter.Selected.Value || ComboBoxFilter.Selected.Value = Blank()
)

 

Any ideas?

 

Thanks,

 

Collin

Categories:
  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @collinktx - assuming the Gallery returns a single record based on the Filter from your Combo Box, you can simply apply the below to the Default property of the Gallery:

     

    First(Self.AllItems)

     

    However, I am not clear if that is what you're trying to do?

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • Verified answer
    BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @collinktx ,

     

    When testing the solution that @Amik proposes I found the selected item always defaults to the first item, also when no changes are made in the Combo Box selection and a different item from the first is selected.

     

    What I found working is setting the OnChange property of the Combo Box to:

    UpdateContext(
     {
     lclGalleryDefault: LookUp(
    			Sharepoint,
    			Location = ComboBoxFilter.Selected.Value || ComboBoxFilter.Selected.Value = Blank()
     )
     }
    )

     

    , and then set the Default property of the gallery to:

    lclGalleryDefault

     

    Like this, whenever the selection in the Combo Box changes, the first item in the gallery is selected.

  • collinktx Profile Picture
    232 on at

    Hi @Amik  and @BCBuizer ,

     

    It looks like both solutions work in my instance. I did notice that @BCBuizer solution always selected the first item created. So if I have a sort of descending it actually selects the last one in the gallery since it is the oldest. Thank you both for your help. I will selected both as accepted.

     

    Thanks

     

    Collin

  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    HI @collinktx ,

     

    In case you decide to make any changes to the Items property of the gallery, you need to make the same changes in the OnChange property of the combo box to keep things in sync.

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard