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 Gallery using S...
Power Apps
Suggested Answer

Filter Gallery using Switch in the filter

(1) ShareShare
ReportReport
Posted on by 17
Hi, 
I have an app that is kind of like a dashboard with a gallery of items from a SharePoint list that have multiple filters on them from the start. Then, I offer some customizable filters and it's all fine. But, I have one column where I want to filter something whether it is overdue or compliant, or not at all. There is not an available column with that category; just the following code has been used for other parts of the app just fine: 
"Overdue"= VerificationDate < Today()-180
"Verfied" = VerificationDate > Today()-180)
 
When the user clicks on the "Overdue", "Verified", or Reset filter, the code is respectively: 
Set(varstatus, "Overdue") OR Set(varstatus, "Verified") OR Set(varstatus, Blank())
 
So the filter for the Gallery Items that is currently working is below, but as soon as I add any If, or Switch, to filter out the above, it stops working. Without the needed filter: 
Filter(
    GFEv2,
    (InactiveToggle = false),
    (Inactive.Value = "no"),
    (Inventory.Value = varTOVIEW),
    (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
    (EquipmentType.Value = DropdownCanvas1_1.Selected.Value Or IsBlank(DropdownCanvas1_1.Selected.Value))) 
and with the filter that makes it all stop working: 
Filter(
    GFEv2,
    (InactiveToggle = false),
    (Inactive.Value = "no"),
    (Inventory.Value = varTOVIEW),
    (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
    (EquipmentType.Value = DropdownCanvas1_1.Selected.Value Or IsBlank(DropdownCanvas1_1.Selected.Value)), Switch(varstatus, "Verified", VerificationDate > Today()-180, "Overdue", VerificationDate< Today()-180))
How would you go about this?
Thanks!
Categories:
I have the same question (0)
  • Kalel_Lucas Profile Picture
    165 on at
    Hello SaraMeiselman,
     
    While far from fast or elegant, you could attempt using your Switch outside the Filter formula, like this:
    Switch(varstatus,
    "Verified", 
    Filter(
        GFEv2,
        (InactiveToggle = false),
        (Inactive.Value = "no"),
        (Inventory.Value = varTOVIEW),
        (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
         VerificationDate > Today()-180
    ),
    "Overdue",
    Filter(
        GFEv2,
        (InactiveToggle = false),
        (Inactive.Value = "no"),
        (Inventory.Value = varTOVIEW),
        (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
         VerificationDate < Today()-180
    ),
    Filter(
        GFEv2,
        (InactiveToggle = false),
        (Inactive.Value = "no"),
        (Inventory.Value = varTOVIEW),
        (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value))
    )
    
    Hope it helps,
    Kalel
  • SaraMeiselman Profile Picture
    17 on at
    Thank you for the suggestion! It didn't seem to work but I can't figure out why because it should have! When I tried clicking on the buttons that set the variable, the gallery went blank. 
  • Suggested answer
    Sam_Fawzi Profile Picture
    902 Super User 2026 Season 1 on at
    Hi Sara,
     
    Can you try this 
     
    Filter(
        GFEv2,
        (InactiveToggle = false),
        (Inactive.Value = "no"),
        (Inventory.Value = varTOVIEW),
        (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
        (EquipmentType.Value = DropdownCanvas1_1.Selected.Value Or IsBlank(DropdownCanvas1_1.Selected.Value)),
        Switch(
            varstatus,
            "Verified", VerificationDate > Today() - 180,
            "Overdue", VerificationDate < Today() - 180,
            true  // Default case for Reset filter
        )
    )
    



    Or



    Filter(
    GFEv2,
    (InactiveToggle = false),
    (Inactive.Value = "no"),
    (Inventory.Value = varTOVIEW),
    (POC.DisplayName = DropdownCanvas1.Selected.Value Or IsBlank(DropdownCanvas1.Selected.Value)),
    (EquipmentType.Value = DropdownCanvas1_1.Selected.Value Or IsBlank(DropdownCanvas1_1.Selected.Value)),
    If(varstatus = "Verified", VerificationDate > Today() - 180,
    varstatus = "Overdue", VerificationDate < Today() - 180,
    true) // Default case for Reset filter
    )
    


    Ensure varstatus is Set Correctly

    Set(varstatus, "Overdue") // For Overdue
    Set(varstatus, "Verified") // For Verified
    Set(varstatus, Blank()) // For Reset filter



     
  • Kalel_Lucas Profile Picture
    165 on at
    Hello Sara,
     
    I think one part that may be missing from the puzzle is where is the user clicking to change the value of the variable varstatus.
    Is it a button? A toggle? A dropdown perhaps?
    If you could attach an image of the method you're utilizing, it can help us understand the context a little bit more.
     
    Kind regards,
    Kalel
  • SaraMeiselman Profile Picture
    17 on at
    Thanks for the suggestions. Neither worked - when I put them into the items property, the gallery remained blank.
    To answer the question about how the variable is set - it's buttons that say "Overdue", "Verified", and "Clear Filter". when you click on one, it resets the variable.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 955

#2
11manish Profile Picture

11manish 652

#3
Valantis Profile Picture

Valantis 626

Last 30 days Overall leaderboard