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

Sort a gallery based on a date condition in ascending order

(0) ShareShare
ReportReport
Posted on by 88

Hi,
I would like to ask for your help. What and where should I set in order to I can sort a gallery with a pre-defined date condition. I need it in ascending order. I use sharepoint list in the background that contains Final_Deadline field based on that I would sort the gallery.

Thank you for your help in advance,

Kriszta

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @Kriszta - what do you mean by "pre-defined" date condition? Do you you simply want to sort on the "Final_Deadline" column?

  • Kriszta Profile Picture
    88 on at

    Hi Amik, I need a simple solution for a simple ascending order but it also would be good to know how I can define that if I need final_deadline between today-14 days and today+14 days in the gallery for example. Is it possible to pre-define it somehow?

  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @Kriszta - basic syntax to sort:

     

    Sort(
     'Your List',
     Final_Deadline,
     SortOrder.Ascending
    )
    

     

    By "pre-define", I think you mean Filter:

     

    Sort(
     Filter(
     'Your List',
     Final_Deadline>= DateAdd(
     Today(),
     -14,
     TimeUnit.Days
     ) && Final_Deadline <= DateAdd(
     Today(),
     14,
     TimeUnit.Days
     )
     ),
     Final_Deadline,
     SortOrder.Ascending
    )
    
  • Kriszta Profile Picture
    88 on at

    It works. Thank you 🙂

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard