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
Suggested Answer

Filtering a Gallery - Choice -- Whats the workaround?

(0) ShareShare
ReportReport
Posted on by 6
I have a choice selection field with Submitted Report, Report in Progress, Pending Report, Completed Report.
 
I wanted to originally create a filter in the gallery so users can filter by BOTH Report in Progress AND Pending Report's....
It appears this might be very difficult to allow the user to select multiple options from a multi-selection combo box and filter.
 
So whats the best way I can accomplish what I want to do? Is there either a workaround, or can I change my combo box to something else whilst still doing what I want?
Categories:
  • Suggested answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    I have a method that I was playing with using a Job Description table and filtering by department which is a choice selection in Dataverse, I would not recommend using this for large data sets.
     
    I created a combo box, with "allow multiple selection" on, and set its Items property to 
     
    Choices('Job Descriptions'.Department)
     
     
    I then set the OnChange property of the ComboBox to 
     
    ClearCollect (
        testViewSelected,
        Filter(
            'Job Descriptions',
            Department = ComboboxCanvas3.Selected.Value
        )
    );
     
    Clear(testViewSelected);
     
    ForAll(
        ComboboxCanvas3.SelectedItems,
     
        Collect(testViewSelected, Filter(
            'Job Descriptions',
            Department = Value)
        )
    );
     
     
    The first ClearCollect is used to create the Collection format. No, it doesn't have to be in the OnChange but I was only testing the feasibility of the approach.
    The collection has to be cleared using the Clear because the collection is built by iterating the selected departments and adding to the collection.
    The Collect creates the collection by filtering for each department.
     
    I used a DataTable to display the data by setting the items to testViewSelected.
     
    I saw a bunch of weird behaviour at first where the items property of the DataTable didn't recognize the collection name until after a second or two. No data was being retrieved for the columns when I viewed the collection until I specified the columns in the DataTable. I also tested it with a gallery.
     
     
     
     
  • Liquid error: Exception has been thrown by the target of an invocation. backinbusiness Profile Picture
    6 on at
    Unfortunately I will have large data set…3,000-5,000 rows per year. Sounds like it’s not an option then?
     
    is there a different structure instead to allow for a similar filtering outcome?
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at
    You have not specified your data source type here,so I will post the SharePoint option (please disregard if I am incorrect). A simple filter that is not Delegable (no issue if your data numbers are under 500) - I am assuming you are filtering on your (single) choice field)
    Filter(
       SPList,
       YourFieldName.Value in ComboBoxName.SelectedItems
    )
    If you want some Delegation capability
    Ungroup(
       ForAll(
          ComboBoxName.SelectedItems As _Items,
          Filter(
             SPListName,
             YourFieldName.Value = _Item.Value
          )
       ),
       Value
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
  • Suggested answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    Instead of what I suggested you build a Filter statement based on the number of options in the combobox.
    The limitation of this method is that you should add a notification to the combobox indicating when the number of selected options has been reached. 
     
    Your Items becomes something like
     
    With(
        {optionCount: CountRows(ComboboxCanvas3_1.SelectedItems)},
        Switch(
            optionCount,
            0,
            'Job Descriptions',
            1,
            Filter('Job Descriptions', Department = Index(ComboboxCanvas3_1.SelectedItems, 1).Value),
            2,
            Filter('Job Descriptions', Or(Department = Index(ComboboxCanvas3_1.SelectedItems, 1).Value, Department = Index(ComboboxCanvas3_1.SelectedItems, 2).Value)),
            3,
            Filter('Job Descriptions', Or(Department = Index(ComboboxCanvas3_1.SelectedItems, 1).Value, Department = Index(ComboboxCanvas3_1.SelectedItems, 2).Value, Department = Index(ComboboxCanvas3_1.SelectedItems, 3).Value))
     
        )
    )
     
    Here I have a maximum of 3 options that can be selected. You can set the default of the switch to select all or none

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