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 / Sort a Gallery based o...
Power Apps
Answered

Sort a Gallery based on combo box using a SharePoint List

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Everyone, I am new to powerapps. First time building. I am having issues with sorting my gallery based upon a choice combo box. I have the combo box working with the sharepoint list. However, I can't get the gallery to show the results. I've tried these formulas in the Gallery item:

Hi Everyone, 

I'm stuck.  I can't seem to get my gallery to show the filter items.  Here's what I've tried.  But nothing shows.  

 

(Tried 1) - Filter(Mandatory_Training, Audience, ComboBox2.SelectedItems)

 

(Tried this one -2 to sort multiple selection) Filter([@Mandatory_Training],Or(IsBlank(ComboBox2.SelectedItems), IsEmpty(ComboBox2.SelectedItems),Audience.Value = Index(ComboBox2.SelectedItems,1).Value,'Audience'.Value = Index(ComboBox2.SelectedItems,2).Value,'Audience'.Value = Index(ComboBox2.SelectedItems,3).Value) (Tried this one -2 to sort multiple selection)

 

(Tried this one 3) Filter(Mandatory_Training, Audience.Value=ComboBox2.Selected.Value)

MandatoryTraining.PNG
Categories:
  • mmollet Profile Picture
    3,187 on at

    Off the top of my head the only way I can think to do this would be the following:

    Filter(Mandatory_Training, Audience.Value in Concat(ComboBox2.SelectedItems, Value))

    This will take all the choices you made and concat them together and then see if the audience.value is found in that anywhere. I tried this and it worked for me. Here was my setup:

    Gallery with HoursLog as my SP List

    SP List items had Name, Hours, and Date as fields

    Gallery Items was set to: Filter(TimeLedger, Name in Concat(ComboBox1.SelectedItems,Value))

    Now when I select multiple names it filters correctly for me. The issue with this will be the delegation with 'in' function. Im not sure if that will effect you or not.

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous 

    Please try the following (This will NOT give a delegation warning),

    *Please change names as required

    Ungroup(ForAll(yourComboBox.SelectedItems As _SelectedItems, Filter(yourSPList, SPListColumn.Value=_SelectedItems.Value)), "Value")

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • mmollet Profile Picture
    3,187 on at

    This is awesome! Never used or even seen the Ungroup function used before! Ty for the knowledge sir!

     

    So this is essentially setting a temp var called _SelectedItems and assigning it the table that combobox.SelectedItems returns. Then it loops through each of the items in that table and parses them off one at a time to apply the filter to? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your response.  Unfortunately, it did not work.  I've attached what it returned.  Hopefully, I entered it right.  

    MandatoryTraining.PNG
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your response.  Unfortunately, it did not work.  I've attached what it returned.  Hopefully, I entered it right.  Delegation warning did appear. No data was displayed.  

  • mmollet Profile Picture
    3,187 on at

    I am assuming then that your dealing with a choice field as well? If you backspace out the "Value" and then start typing " what pops up? it should use intellisense to give you an option/options. For me it only gave value as my column is not a complex column. I dont use complex columns as they cause everything else in the app to be overly complex as well. 

     

    EDIT: I was able to make this work for a choice column as well and the results were accurate with no delegation. 

    Ungroup(ForAll(ComboBox1.SelectedItems As SelectedItems, Filter(TimeLedger, NameTest.Value = SelectedItems.Value)), "Value")

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous I assume that Audience is a column of type Choice in the SP List and you have Choices(Mandatory_Training.Audience) in the Items property of the Combobox.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes.  That is correct.  

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

    Hi Community,  Thank you  so much for helping me.  I got it to work with this  Filter(Mandatory_Training, Or(IsBlank(ComboBox2.SelectedItems),IsEmpty(ComboBox2.SelectedItems), true in ForAll(ComboBox2.SelectedItems, ThisRecord.Value in Audience.Value))).  However I still get a delegation error.  But I see data 🙂

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous The formula I gave should work and that without delegation @mmollet has confirmed this as well. To check it out, put that formula in the OnSelect of a Button and collect the results in a Collection and let me know what you get. 

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard