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 a gallery based...
Power Apps
Unanswered

Filter a gallery based on checkbox in another gallery?

(0) ShareShare
ReportReport
Posted on by 112

I am currently using a drop-down menu to filter a gallery. I want to change the code so that the gallery will i stead filter based on items checked in another gallery instead.

 

I can't imagine the code is too difficult to change, but I can't wrap my head around it. Tried searching these forums, as well as enlisting CoPilot.

 

Here is the code I am using to do the dropdown based filtering:

 

If(IsBlank(Dropdown1.Selected),Filter(Frameworks, Framework_ID=FrameworkSelected),Filter(Frameworks, Theme_ID=LookUp(Frameworks, Theme=Dropdown1.Selected.Result, Theme_ID)))

 

Does anyone know how I can change this to filter based off of checkboxes in another gallery?

Categories:
  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    Hi @elfreddos ,

    Firstly you can condense what you have to this

    Filter(
     Frameworks, 
     Framework_ID = FrameworkSelected &&
     (
     Len(Dropdown1.Selected.Result) = 0 ||
     Theme_ID = Dropdown1.Selected.Result
     )
    )

    but what is the gallery name, the field name in it and the field name in your data source that it needs to match ?

  • elfreddos Profile Picture
    112 on at

    Thanks.

     

    The gallery that has the checkboxes in is called: Gallery12

     

    Gallery12 has an items property with the following code:

     

    ForAll(Distinct(Filter(Frameworks, Framework_ID=FrameworkSelected),Theme), {Result: ThisRecord.Value})

     

    So for instance, depending on the Framework selected in a previous step, Gallery12 might display 5 or 6 checkboxes associated with a Theme. Then, if one of those themes is ticked (rather than selected from the dropdown) it will filter the original gallery.

     

    Gallery12 checkbox has the following code inside the Checked property:

     

    If(Not(IsBlank(Title1_1.Text)),If(IsEmpty(Filter(Themes_1, 'Project ID'=ProjectSelected.ID, 'Theme ID' = LookUp(Frameworks, Theme = Title1_1.Text, Theme_ID))),false,If(LookUp(Themes_1,'Project ID'=ProjectSelected.ID && 'Theme ID'=LookUp(Frameworks, Theme = Title1_1.Text, Theme_ID),'Theme in use?')="false",false,true)))

     

  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    @elfreddos ,

    Assuming Theme_ID is in the gallery and matches the record in the List

    With(
     {
     _Data:
     Filter(
     GalleryName,
     CheckBoxName.Value
     ),
     _List:
     Filter(
     Frameworks, 
     Framework_ID = FrameworkSelected
     )
     },
     Filter(
     _List,
     Theme_ID in _Data.Theme_ID
     )
    )

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • elfreddos Profile Picture
    112 on at

    Thanks, but while no red lines are underneath any of the code, the gallery now has a red X eit the following error: "Incompatible types for comparison. These types can't be compared: Text, Error."

     

    In the gallery for the metrics, where I would normally expect to see dara, I am also seeing the following error: "Name isn't valid. 'ThisItem' isn't recognised."

  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    @elfreddos ,

    I was basing my code on what you have posted assuming this part is valid (as it is in your original posted code)

    Filter(
     Frameworks, 
     Framework_ID = FrameworkSelected
    )

    the next part assumes (as I noted) that the Theme_ID field was present in your gallery Is this the case - what is the Items of the Gallery?

     

  • elfreddos Profile Picture
    112 on at

    Gallery12 has an items property with the following code:

     

    ForAll(Distinct(Filter(Frameworks, Framework_ID=FrameworkSelected),Theme), {Result: ThisRecord.Value}

     

    The code you wrote out I added to the Items property of the metrics gallery (Gallery2). Is that not correct?

     

    To avoid confusion, I will reiterate. I have a gallery (Gallery12) with the below Themes, which change based on the framework sselecte:

     

    1000047626.png

    Now, because I have ticked Jobs as I have there I should see the associated metrics in the gallery underneath (where the blue line is).

     

    In this particular case, I should see the data from column Metric_ID and Metric, but I don't see anything 

     

    1000047625.png

  • WarrenBelz Profile Picture
    156,536 Most Valuable Professional on at

    @elfreddos ,

    Sorry, but I am getting a bit lost here - what does Metric_ID have to do with this ? To simplify this, assuming Theme in Gallery12 (which is actually now the Result field) has the same value as Theme_ID (what is the difference?) then

    With(
     {
     _Data:
     Filter(
     Gallery12,
     CheckBoxName.Value
     ),
     _List:
     Filter(
     Frameworks, 
     Framework_ID = FrameworkSelected
     )
     },
     Filter(
     _List,
     Theme_ID in _Data.Result
     )
    )

    The whole point is that you have to match a field from the gallery where a checkbox is checked in the record. The only actual field in Gallery12 is Result, so that needs to match the appropriate field in Frameworks.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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