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 / Sort Gallery by number...
Power Apps
Unanswered

Sort Gallery by numbers (4 is recognized bigger than 11)

(0) ShareShare
ReportReport
Posted on by 4

Dear Community,

 

I have a question concerning the sort option of a gallery in PowerApps.

I oriented my Sort Button on the following video  https://www.youtube.com/watch?v=6KlI1iZ_KD0

Now I have the problem that when I try to sort my gallery by a column that contains numbers, the value of these numbers is only validated by the first digit. As an example is the number 19 only sorted after the 1 and is therefore listed lower than the number 4 which should obviously be the other way round. That means, that the numbers 10-19 are recognized as smaller than the numbers 2-9. (the order within these numbers is perfectly fine. For example is a 7 listed lower than a 9)

Just to make the problem clear here are a few more examples: 3<4, 5<8, 11<13, 17<19 but 2>11, 3>16, 9>11. 

Is anyone facing the same problem?

A possible solution could be to just add a 0 infront of the numbers with just one digit. So turn a 3 into an 03 and a 6 into a 06. But I'm not sure how to do that either.

 

I'm really looking forward for any kind of advice and thank you for your help in advance!!

 

Best Regards and stay safe

Matteo

 

 

Categories:
  • C-Papa Profile Picture
    1,836 on at

    Hi, i believe this is because the numbers are being stored as text, not values. you would either need to convert your column to a number column or use the AddColumns() function to convert the text to a number

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @losti 

    You can wrap the number in Value() or simply multiply it *1. PowerApps seems to recognize text as numeric if an arithmetic function is applied to it.

  • losti Profile Picture
    4 on at

    @Drrickryp @C-Papa 

    Thank you for your help. 

     

    I tried to use the Value() and the *1 function, but unfortunately none of them worked. 

    I will post the code for the column below, maybe that might help.

    Just to make it clear, I'm using the sum() function to get to the number that i afterwards want to sort after. 

     

    I'm again really looking forward for any kind of advice and thank you for your help in advance!!

     

    Best Regards and stay safe

     

    losti_0-1621786286133.png

     

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @losti 

    Wrap the item like this Value(This item.xxx) inside the Sum() function.

  • UnknownPlayer Profile Picture
    2 on at

    Hey,

    my problem is quiet similar to @losti s one. 
    Even tho I tried to convert the numbers to numeric (e.g Value(), *1) it doesnt change the odds.

    Are there any further possibilities to solve this problem?

    Thanks in advance! 

  • jonas_aac Profile Picture
    11 on at

    Hi, I had exactly same issue. Tried all sorts of things. Found a pretty simples solution that works.

     

    Multiply inside the Sort function the value by a low decimal value such as 0,000000001. The sort will be applied to the multiplied value but displayed the correct one.

     

    Exampleo:

    data:

    Col1 col2

    d1    1

    d2     11

    d3     2

    Sort(Data, col2*0,000001)

     

    This will get the sorted that in this order

    d1, d3, d2 instead of

    d1,d2,d3

     

    Hope that helps

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 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard