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

Filter Gallery for Overdue button

(0) ShareShare
ReportReport
Posted on by 43

Hello Community,

I created a container that has Button gallery to filter assigned assets based AllPermanentTemporary& OverDue. 

All filters by all Assets

Permanent filters by Permanently assigned assets.  --choice column  named Status

Temporary filters by temporary assigned assets ---choice column  named Status

Overdue filters by assets past their ReturnDate (a SharePoint column).

frank90_2-1711363886633.png

 

I can successfully filter my gallery with the All, Permanent and Temporary buttons. am having a challenge filtering Overdue button.

I want the OverDue button to check status column for temporary assets and also the ReturnDate column and then filter those assets that are past their Due date.

 

The code for Items of the Buttons gallery :

Table({varFilter:"All"},{varFilter:"Permanent"},{varFilter:"Temporary"},{varFilter:"OverDue"})
 
This is the code of the main gallery under Items on which i make my filters which are successful. 
If(TabsGallery.Selected.varFilter="All ",'Asset Register',Filter('Asset Register',Status.Value= TabsGallery.Selected.varFilter))
 

I need help to add the OverDue functionality to this filter query.


You can also suggest new functionality for both the buttons and filter codes.

Categories:
I have the same question (0)
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @frank90 ,

     

    Does the OverDue mean that ReturnDate is less than today?

    If so, please try this.

    Switch(TabsGallery.Selected.varFilter,
    "All ",
    'Asset Register',
    "Permanent"||"Temporary",
    Filter('Asset Register',Status.Value= TabsGallery.Selected.varFilter),
    "OverDue",
    Filter('Asset Register',Status.Value="Temporary"&&ReturnDate<Today()))

     

     

    Best regards,

    Rimmon

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @frank90😊

     

    Adjusting the Filter condition slightly allows us to avoid the If statement. The code below will:

     

    • Apply no filter when 'All' is selected
    • Filter based on status 'Permanent' in case that is selected - otherwise filter based on 'Temporary'
    • Apply an additional return date filter in case OverDue is selected (only return records past the Return Date)

     

    Filter(
     'Asset Register',
     //Either all is selected
     TabsGallery.Selected.varFilter = "All" || 
     //Or filter based on status (overdue also being permanent)
     ((TabsGallery.Selected.varFilter = "Permanent" && Status.Value = "Permanent") || (TabsGallery.Selected.varFilter <> "Permanent" && Status.Value = "Temporary")),
     //If OverDue is selected, add additional filter checking for records with an overdue return date
     TabsGallery.Selected.varFilter <> "OverDue" || ReturnDate < Today()
    )

     

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

    Thanks!

  • frank90 Profile Picture
    43 on at

    When i run the app, the permanent button returns " All Assets" instead of the Permanent assets only. But the Overdue functionality is working.

  • frank90 Profile Picture
    43 on at

    this is the error I get with the Switch function.
    frank90_0-1711370877606.png

     

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

    Hi @frank90,

     

    Thanks for the feedback, adjusting '(Status.Value = "Temporary")' to '(TabsGallery.Selected.varFilter <> "Permanent" && Status.Value = "Temporary")' should do the trick.

     

    I have adjusted my previous code accordingly. Below an alternative version using an If function:

     

    If(
     TabsGallery.Selected.varFilter = "All",
     'Asset Register',
     TabsGallery.Selected.varFilter = "Permanent" || TabsGallery.Selected.varFilter = "Temporary",
     Filter('Asset Register', Status.Value= TabsGallery.Selected.varFilter),
     TabsGallery.Selected.varFilter = "OverDue",
     Filter('Asset Register', Status.Value= "Temporary" && ReturnDate < Today())
    )

     

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @frank90 ,

     

    So, where does the error appear in the code?

     

    Best regards,

    Rimmon

  • frank90 Profile Picture
    43 on at

    This works 🙂. Thank you @LaurensM 

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 638

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard