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 / Sort gallery by expired
Power Apps
Answered

Sort gallery by expired

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have this gallery where i would like to show only active accounts.

 

I have fields with date created and expiration date (48 hours after date created)

 

How can i by default only show items that has not yet expired, but if the user selects "inactive" on dropdown it will show all expired accounts?

 

Right now, my gallery Items is like this:

 

 

Search(Filter(VikarAccessLog;OrdereEmail=varCurrentUser.Email); AktiveringsHistorikSearch.Text; "VikarName")

 

 

34243242424.png

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    Hi @Anonymous ,

    Try this - the With() statement is to keep it a bit Delegable

    With(
     {
     wData:
     Filter(
     VikarAccessLog;
     OrdereEmail = varCurrentUser.Email
     )
     },
     Search(
     Filter(
     wData;
     (
     DropdownName.Selected.Value = "Inactive" &&
     DateDiff(
     Created;
     Now();
     Hours
     ) > 48
     ) ||
     DateDiff(
     Created;
     Now();
     Hours
     ) <= 48
     );
     AktiveringsHistorikSearch.Text; 
     "VikarName"
     )
    )

     

    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

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @WarrenBelz 

     

    Thanks so much for the help! 

    It worked just like intended. Almost. 😅

    Now it hides all inactive by default, but if i select the inactive on dropdown, i will still see the active accounts.

     

    Also, i just had to change the Hours to TimeUnit.Hours and it worked flawless after.

     

    FantaFreake_0-1677832453456.png

    FantaFreake_4-1677832531202.png

     

     

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard