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 by...
Power Apps
Answered

Filtering a gallery by 2 different dropdown controls

(0) ShareShare
ReportReport
Posted on by 332

I have a gallery that is filtered by a dropdown control (Dropdown1). The Items property of the gallery is:

Switch(
Dropdown1.Selected.Value,
"Choice 1",
Filter(
GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
Column1 = "true"
),
"Choice 2",
Filter(
GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
Column2 = "true"
),
"Choice 3",
Filter(
GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
Column3 = "true"
)

 

The grouping is done because I have a nested gallery (Gallery2) inside Gallery1. The Items property of my nested gallery is ThisItem.DATA. This works fine so far. My problem is that now I have a second dropdown that also needs to filter Gallery1. I can't figure out how to integrate that filtering into the code that I have now.

Any suggestions would be greatly appreciated!

Categories:
  • Fardy_MADI_2 Profile Picture
    334 Super User 2024 Season 1 on at

    Hi @T_A_M,

     

    You could try to concatenate the value of your two dropdowns and then list all possible combinations in the Switch. Something like that :

    Switch(
    Dropdown1.Selected.Value & Dropdown2.Selected.Value,
    "Choice 1",
    Filter(
    GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
    Column1 = "true"
    ),
    "Choice 2",
    Filter(
    GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
    Column2 = "true"
    ),
    "Choice 3",
    Filter(
    GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
    Column3 = "true"
    )

      

    Hope this will help you 🙂

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @T_A_M,

     

    Do I understand it correctly that Dropdown1 and Dropdown2 will filter different columns and need to be used at the same time to filter multiple columns? In that case, we can make some small adjustments that will (1) avoid code repetition, (2) make the code more readable and (3) scalable:

    Filter(
     GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
     //Your switch is replaced by the following:
     (Dropdown1.Selected.Value = "Choice 1" && Column1 = "true") || (Dropdown1.Selected.Value = "Choice 2" && Column2 = "true") || (Dropdown1.Selected.Value = "Choice 3" && Column3 = "true")
    )

     

    Now to add dropdown 2, we simply add a comma and a new filter condition row in the same manner. I will give and example that filters column4 and column5 on a certain status:

    Filter(
     GroupBy('MyDataSource', "Column1", "Column2", "Column3","DATA"),
     //Your switch is replaced by the following:
     (Dropdown1.Selected.Value = "Choice 1" && Column1 = "true") || (Dropdown1.Selected.Value = "Choice 2" && Column2 = "true") || (Dropdown1.Selected.Value = "Choice 3" && Column3 = "true"),
     //Dropdown 2 is added here
     (Dropdown2.Selected.Value = "Choice 4" && Column4 = "true") || (Dropdown2.Selected.Value = "Choice 5" && Column5 = "true")
    )

    Instead of using Switch(Dropdown2... , "Choice 4", Column4 = true) you use the filter condition (Dropdown2.Selected.Value = "Choice 4" && Column4 = "true")

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • T_A_M Profile Picture
    332 on at

    That's brilliant! Works perfectly. Thank you for your help.

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

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
timl Profile Picture

timl 122 Super User 2026 Season 2

Last 30 days Overall leaderboard