web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sort Button to Sort Du...
Power Apps
Answered

Sort Button to Sort Due Dates

(0) ShareShare
ReportReport
Posted on by 106

Happy Friday! 

 

I have created an action tracker within PowerApps. I have a due date column on my SP list. I am wanting to have a sort button on my gallery that when selected will sort all of the actions by their due dates. The ones closer to being due being at the top. What should I add into my OnSelect property of my button? Do I also need to add something else into my gallery's items as well? Thanks in advance! 

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,609 Super User 2025 Season 2 on at

    Hi @kat7777777 

     

    On your OnSelect propety your code should look like:

    SortByColumns( 
     <SP LIST>, 
     "DueDate", 
     SortOrder.Descending 
    )

     

    The Sort function sorts a table based on a formula.

    The SortByColumns function can also be used to sort a table based on one or more columns.

     

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @kat7777777 The On Select Property of your button I would do something like setting a contextual variable: 

    UpdateContext({DueDate:!DueDate})

    Then in you gallery Items Property I assume you using a SortByColumns you would need to add the following: 

    SortByColumns( 
     YouSPList, 
     "DueDate", 
     If(DueDate,SortOrder.Descending,SortOrder.Ascending)
    )

    This will then give you the ability to switch between the descending and ascending order. 

     

    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. Remember, you can accept more than one post as a solution. If the content was useful in other ways, please consider giving it Thumbs Up.


    Thanks
    Andrew

  • kat7777777 Profile Picture
    106 on at
    Hello, This is what I currently have in the items property of my gallery. Filter( [@'101 HR Action Tracker'], (Progress.Value = "Not Started" || Progress.Value = "In Progress") && (IsBlank(Dropdown1.Selected) || CategoryDuplicate = Dropdown1.Selected.Value) ) I have a drop down in place is why it is entered this way. When I try to add in the additional coding you provided, I receive an error. Do you have any advice?
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    The Syntax would look like this

    SortByColumns( 
     YouSPList, 
     "DueDate", 
     If(DueDate,SortOrder.Descending,SortOrder.Ascending)
    )

    Replace YouSPList with your Filter function

  • Verified answer
    AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @kat7777777 you will just replace yourSPList with your filter: 

     

    SortByColumns( 
     Filter( [@'101 HR Action Tracker'], (Progress.Value = "Not Started" || Progress.Value = "In Progress") && (IsBlank(Dropdown1.Selected) || CategoryDuplicate = Dropdown1.Selected.Value)), 
     "DueDate", 
     If(DueDate,SortOrder.Descending,SortOrder.Ascending)
    )

     

     

    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. Remember, you can accept more than one post as a solution. If the content was useful in other ways, please consider giving it Thumbs Up.

     

    Thanks 

    Andrew

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard