Showing results for 
Search instead for 
Did you mean: 
Power Automate
Power Automate

Sort Ascending / Decending

What property drives which colum will be sorted when tapping the sort ascending/decending icon? Mine seems to be doing it's own thing. Smiley Frustrated



Community Champion
Community Champion


I tried also with your numbers, but it seems to work fine...

Could you please provide steps to reproduce the problem?




Community Champion
Community Champion



Thanks for sharing.

My scenario very very straightforward. Just no idea why!



Community Champion
Community Champion

Hi hpkeong,  I think it is because your "Number" field is actually text.


Does this work?


Sort( Table1, Value(Number))
Community Champion
Community Champion

Hi Meneghino

I guess so, too. In Excel, even it is set as Numeric, it did not work, too.
Anyway, I will try on CDS.
Thanks a lot for sharing of such a 😁 case.

Have a nice day.

I have display data from collection.


Dropdown list contain 3 values

Items = ["Name", "Maker","Price"]


- I have used Gallery to display data.

- When I select value from Dropdown list, Sorting work perfect. Let I selected Price from dropdown, then gallery display data sorted by Price. It works fine

- Now I want to apply Ascending / Decending on this sorted data when I click UpDown Icon. Please refer image for clarity of my question.

- How can I do this ?


Sort Que_Avnish New.png


Finally I got answer which is :


SortByColumns (PriceList,If(Dropdown.Selected.Value = "Name", "Name", Dropdown.Selected.Value = "Maker", "Maker", Dropdown.Selected.Value = "Price", "Price"), If(SortDescending1, Descending, Ascending))


Frequent Visitor

When I use a people picker field like this "Employee" in the Search formula, it s giving me an error saying that "A field of text type is expected" and it is the same case with date type fields as well. Could you please let me know how can we use people picker and date fields in Search and SortByColumns formulas.

I looked and looked to try and figure out why my list was not sorted in numerical order. I used this simple post to get it to work! Thanks!


Dear Miss @aftowen 


I've tried to sort the records with serial number like 1,2,3,4... with the code your provided, but unfortunately it's not performing well, like its sorting in 1,10,11,12.. 2,20,21..,3,30,31... and so on.. 


Please help how to fix this.!

New Member

For anyone who is discovering this thread like me and doesn't want to go on another goose chase for information:


When you've created an app that is just from one of MS' templates, and you want to edit the sort button to sort by a different criteria, you CAN NOT intuitively click on the sort button and edit the criteria in the formula for the button.


No, because this is MSFT with totally out of touch UX designers, you need to:
Click on the 'BrowseGallery1' and click the formula bar for that.


My formula is like this (also in screenshot):


SortByColumns(Filter([@'Customer Contacts'], StartsWith('Customer ID', TextSearchBox1.Text)), "Customer_x0020_ID", If(SortDescending1, Descending, Ascending))


The column that you sort by, is the second parameter/item in the syntax of the 'SortByColumns' function.

My source had a filter added to it which is for the search bar.  However you can see that this filter is all in parentheses and makes up the first parameter, so the second parameter/item is "Customer_x0020_ID".  So why am I sorting by that column name "Customer_x0020_ID" instead of just 'Customer ID' like in the 'Filter' function?
Because the trashcan design of this scripting language requires you to, in some instances, (so we can't even have consistency, yay) add "_x0020_" for every space in a column name.  So "Customer_x0020_ID" actually translates to "Customer ID". 

Yes blabla 'best practices' (more like limitations) for column names, but there are plenty of times you want to have spaces to make things more readable for the humans actually reading the columns.


As long as MS requires individuals to know unicode character codes (something easily convertible by the PowerApps interface in the background) and follow non-intuitive design structures, PowerApps is never going to see widespread adoption, including at the 'Power User' level.


I've tried to make this less jargon-filled than some of the other answers and hope this can help anyone stumbling across this thread in the future.


Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,712)