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 / Unable to sort by date
Power Apps
Answered

Unable to sort by date

(0) ShareShare
ReportReport
Posted on by 4

Hi

 

I'm trying to use the sort icon to sort by start date for an Onboarding form but not getting anywhere. 

 

Capture99.JPG

Currently the Items property of gallery looks like this: SortByColumns(Filter([@'New User Process'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

The OnSelect looks like this: UpdateContext({SortDescending1: !SortDescending1})

 

I'm new to Powerapps so any help would be greatly appreciated.

 

Cheers

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @schandra1 ,

    You just need the below - put your actual date field name where shown below.

    SortByColumns(
     Filter(
     [@'New User Process'], 
     StartsWith(
     Title, 
     TextSearchBox1.Text
     )
     ), 
     "YourDateFieldName", //put actual date field name in here
     If(
     SortDescending1, 
     Descending, 
     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. If the content was useful in other ways, please consider giving it Thumbs Up.

  • v-yutliu-msft Profile Picture
    on at

    Hi @schandra1 ,

    I agree with @WarrenBelz 's formula.

    Just to supplement his reply.

    Please notice the syntax of SortByColumns function:

    SortByColumnsTableColumnName1 [, SortOrder1ColumnName2SortOrder2, ... ] )

    The columnname decides sort by which column and the order of column name decides the sort order.

    However, in your formula, the column name is Title, not StartDate.

    SortByColumns(Filter([@'New User Process'], StartsWith(Title, TextSearchBox1.Text)),

                              "Title",

                             If(SortDescending1, Descending, Ascending))

    So the sort icon will not work for start date.

     

    If you only want to sort based on startdate, you just need to replace Title with startdate field.

    Try this:

    SortByColumns(Filter([@'New User Process'], StartsWith(Title, TextSearchBox1.Text)), "StartDate", If(SortDescending1, Descending, Ascending))

    If you not only want to sort based on title but also want to sort based on startdate, you just need to add startdate field.

    Try this:

    SortByColumns(Filter([@'New User Process'], StartsWith(Title, TextSearchBox1.Text)), 
     "Title",Ascending,
     "StartDate", If(SortDescending1, Descending, Ascending)
     )

     

     

    Here's a doc about this function for your reference:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

     

     

    Best regards,

  • schandra1 Profile Picture
    4 on at

     Hi Guys

     

    Changing the start date field worked like a charm.

     

    Thank you both for your help.

     

    Cheers

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard