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 / Use Item from Multi-Se...
Power Apps
Answered

Use Item from Multi-Select combobox to filter gallery

(0) ShareShare
ReportReport
Posted on by 5,836 Moderator

This is a bit different than most questions surrounding this.

 

I am creating a comparison that will consist of a combobox and 4 galleries.  The galleries visibility will be controlled by how many items are selected in the Combobox.

 

What I need to do now is to set each gallery to be filtered by the matching selection in the combobox.

 

Gallery1 would be selected by the first item in the box

Gallery2 would be selected by the 2nd item in the box and so on.

 

I don't know if I need to use ungroup, with, as or a combination of these to extract the correct item to use for filtering each gallery.

 

Any help will be appreciated.

 

@RandyHayes 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JR-BejeweledOne 

    I need a little clarity on the scenario.

    Can you provide the Items property for the Combobox and explain a little about these phrases : "Gallery1 would be selected by the first item in the box"?

    Are you referring to a visible property or something to do with the Items of the Gallery or actually selecting the Gallery items?

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I am trying to setup a compare.  These are Holiday lists for different countries or country/regions.   The thought is that someone could select up to 4 different locations from the list of locations in a combobox. 

     

    Each one of the selected locations would be the filter for 1 of the 4 galleries.   There are 2 additional screens in the app that show the holidays in different ways.  To give you an idea, here is one of the screens.

     

    holidaymonthview.png

     

     

    The goal for the last screen is to show the holidays for the selected locations the same you see in the gallery on the right.

     

    The formula for that gallery:

     

     

    If(
     !IsBlank(DropdownRegion2), Sort(Filter(Holidays, Country = DropdownCountry2.Selected.Result && Region = DropdownRegion2.Selected.Result), Date, Ascending),
     Sort(Filter(Holidays, Country = DropdownCountry2.Selected.Result), Date, Ascending)
    )

     

     

     

    The combobox is multi-select showing 2 fields and the formula is:

     

     

    GroupBy(HolidaysIndividual,
     "Country", "Region", "Result"
    )

     

     

    So if my ComboBox selection looks like this, where #1 is the country and #2 is the region.   I want to filter gallery1 by Australia, New South Wales (NSW), Gallery2 by Australia, Queensland (QLD), Gallery3 by Australia, South Australia (SA) and Gallery4 by Australia, Victoria (VIC), with the understanding that it could be any item selected from the list.

     

    comboboxselect.png

     

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

    @JR-BejeweledOne 

    Thanks for the detailed information.

    So one thing - are you limiting to 4 selections?  You mention 4 galleries...so what if there are 5 selections or 3?

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I am limiting to 4.

     

    There will be Count values to compare for visibility of the galleries and could be used for the items property as well in galleries 2 - 4.

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

    @JR-BejeweledOne 

    So then for the Visible property of each Gallery:

    Gallery1 -  CountRows(yourCombobox.SelectedItems)>0

    Gallery2 -  CountRows(yourCombobox.SelectedItems)>1

    Gallery3 -  CountRows(yourCombobox.SelectedItems)>2

    Gallery4 -  CountRows(yourCombobox.SelectedItems)>3

     

    Items property of Galleries:

    Gallery1:

     

    With({_sel: Last(FirstN(yourCombobox.SelectedItems, 1)},
     Sort(
     Filter(Holidays, 
     Country = _sel.Country &&
     Region = _sel.Region
     ),
     Date
     )
    )

     

     

    Gallery2:

     

     

    With({_sel: Last(FirstN(yourCombobox.SelectedItems, 2)},
     Sort(
     Filter(Holidays, 
     Country = _sel.Country &&
     Region = _sel.Region
     ),
     Date
     )
    )

     

     

     

    Gallery3:

     

     

    With({_sel: Last(FirstN(yourCombobox.SelectedItems, 3)},
     Sort(
     Filter(Holidays, 
     Country = _sel.Country &&
     Region = _sel.Region
     ),
     Date
     )
    )

     

     

     

    Gallery4:

     

     

    With({_sel: Last(FirstN(yourCombobox.SelectedItems, 4)},
     Sort(
     Filter(Holidays, 
     Country = _sel.Country &&
     Region = _sel.Region
     ),
     Date
     )
    )

     

     

     

     

    Now, the above is a lot of duplication and the reality is you can really have all the information in the Combobox

     

     

     

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I don't see any difference in the very last formula from the ones above that you say are duplication.

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

    @JR-BejeweledOne 

    Actually, that very last part with the header of Gallery3 is all to be ignored.  I believe I copy/pasted one too many times and didn't notice that part below my last sentence about the duplication and combobox when I hit reply.

    I've removed it out of the post.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard