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




Hi, there is no small limit to nesting of If statements that I am aware of, so three should be fine.

Why is there a Search function in your Items property without any search parameters?

@HuseyinAhmet wrote:

As one small follow up, I've tried sorting by a third value, DEF, however whenever I try to add this as a third If condition, nothing seems to work, are conditions locked to 2 max or is there some sort of workaround? 



Sorry for intervening into the discussion. May I suggest another way?


You can still maintain the TextSearchBox, and replace the Sorted Column with DropDown.

- Create a Dropdown with: Items = ["Name",  "ATK", "DEF']

- Replace the Sorted column, example, Name, with Dropdown.Selected.Value


SortByColumns(Search(MyDataSource, TextSearchBox1.Text, "Name", "ATK", "DEF"), Name, If(SortDescending1, Descending, Ascending))....Replaced with

SortByColumns(Search(MyDataSource, TextSearchBox1.Text, "Name", "ATK", "DEF"), Dropdown.Selected.Value, If(SortDescending1, Descending, Ascending))


So, when you Select the items in the Dropdown, and press on Sort (Up-Down Arrow) button, it will sort based on the dropdown selected button.


Please see my sample and hope it meets what you want in a simple way.


Screenshot (50).pngScreenshot (51).png


To answer the Search parameter question, that is there because in my actuall app I am seraching for things, I did not want to post all of the parameters here.
I also managed to solve the issue with certain numbers not sorting correctly, this was because they were being sorted as plain text rather than as variables.
Finally I Also Fixed the third If statement Issue, I was doing something slightly wrong with the close brackers, everything is working how I would like it to, but thanks again for the response SteelMan.

Community Champion
Community Champion

@audrieg wrote:

That worked!  (I am going to put an idea in that they made the change behind the scenes as the gallery items are selected.)


Thank you!



I have added in this thread that you can use Dropdown.Selected.Value to replace the Sorted Column and bind to a Dropdown to make the sorting a dynamic one based on what you select.

Please see my reply in one of the thread here.




Hello hpkeong,


I will give this a go, and maybe use both to compare which is better.





All methods are OK to you.

I just wish to share another option that just add a dropdown without adding many Sorting Buttons.

Smiley Happy


Hey hpkeong,

A quick question about how things are sorted with the drop down, I am running into an issue that I had previously when sorting DEF with the previous version. DEF are numerical values, and I believe because powerapps was taking the numbers as plain text values, when they were sorted they would appear as such:


When what I would want would be:


To fix this issue I made sure that when sorting by ATK I sorted by its value, for example:

Sort(Search(MyDataSource, TextSearchBox1.Text, "NAME", "ATK", "DEF"), Value(DEF), If(SortDescending3, Descending, Ascending))

Now when sorting with the dropdown, it takes the value of the selected item on the list, but returns the plaintext sorted list rather than the value sorted list, which is not what I want:

SortByColumns(Search(MyDataSource, TextSearchBox1.Text, "NAME", "ATK" ,"DEF"), Dropdown1.Selected.Value, If(SortDescending1, Ascending, Descending))

I've tried Value(Dropdown1.Selected.Value) and I've tried making the Items in the dropdown Value("ATK") but neither of these seem to work, would you know why this is happening?

Community Champion
Community Champion



I tried, too, on Sample Data from Tutorial.

Even the sample data shown also can;t sort as expected for NUMBER.

In this case, I am sorry for not able to provide solution ehere and hpe someone or PG can come it to help clarify the proper solution to sort Number, in dequence (instead of of based on the 1, 2, 3, 4,...).


Sample screenshot of failure.

Screenshot (52).png


Hi @hpkeong and @HuseyinAhmet

I could not reproduce your issue, I can get numbers stored as text to be sorted numerically by using the AddColumns function like in the following screenshot.

Or do I misunderstand your issue?  In that case, please provide steps to reproduce.





In fact, Sorting is possible except when you have 1, 2, 3, 4,...10, 11,12,...and above.

1 ~ 10 will affects the sorting.


1, 10, 11, 2, 12, 3, 4, 5, 6, 7, 8,...

So, if you do not hvae 1 ~ 10, but start from 10, it has no problem,




Helpful resources

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users


We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (54,866)