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 / SortByColumns (Sequenc...
Power Apps
Unanswered

SortByColumns (Sequence of data is not working correctly)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all, 

for my Order History screen, I have a data table to display past orders. Users can choose SMT Line No from the dropdown menu and have their orders displayed inside the data table.  I would like the data table to display orders in descending order based on the OrderDateTime (time and data order placed by users).

I have this configured at data table's Items property:

 

 

SortByColumns(
 Filter(
 'Order Summary',
 SMTLineNo = Dropdown1.Selected.Value
 ),
 "field_0",
 SortOrder.Descending
)

 

 

 

To me, the code is already correct and I got no error. However, during testing, this is what I got. It/s working fine for some and not for some. 

AmiraRoslan_0-1696295285323.png

Where did I go wrong?

 

 

Categories:
  • WarrenBelz Profile Picture
    156,770 Most Valuable Professional on at

    Hi @Anonymous ,

    Assuming field_0 is your OrderDateTime field (why the different name) and this is a Date/Time field in SharePoint. there is nothing wrong with the code - is this assumption current ?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @WarrenBelz, the OrderDateTime is Single line of text in my SharePoint List. I already try used OrderDateTime name but I got errors that says "Specified column OrderDateTime does not exist". 

    AmiraRoslan_0-1696296772457.png

     

  • WarrenBelz Profile Picture
    156,770 Most Valuable Professional on at

    @Anonymous ,

    I assume then the field name is field_0 - but your issue is a Text field containing a date will sort alphabetically, not in Date order.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz 

    Yes, field name is field_0. So I guess I have to change the data type of OrderDateTime in the SharePoint, form Text to Date/Time? Or is there any way that I could manipulate the data that I already have so that it can read in Date order?

  • WarrenBelz Profile Picture
    156,770 Most Valuable Professional on at

    @Anonymous ,

    It is generally always better to store date/time values in the proper field type, but if your format is a valid date/time, you could try this

    SortByColumns(
     AddColumns(
     Filter(
     'Order Summary', 
     OrderStatus.Value = "Order Received"
     ), 
     "SortDate",
     DateTimeValue(field_0)
     ),
     "SortDate",
     SortOrder.Descending
    )

     

    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

    Thank you for the suggestion, I'll try.

     

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 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard