Skip to main content

Notifications

Community site session details

Community site session details

Session Id : rPjGvWSCjmrxdwxdyVL2ky
Power Apps - Building Power Apps
Answered

PowerApps Gallery Sort not working properly

Like (0) ShareShare
ReportReport
Posted on 18 Jan 2024 18:08:08 by 73

Hello,

 

I am working on a Location based Canvas App and have a gallery with Title and Subtitle fields that pulls data from a PowerApps collection and the Gallery is sorted in the ascending order by the Sub Title data.  The Collection has 660 rows with 2 columns (Location and Distance). 

 

Title (Location Column)

Subtitle (Distance Column)

 

The sort works fine for first 5 items and then it skips many records and jumps higher as shown below. In between there are many locations between 10 and 90 miles and not sorting properly

 

PowerUser39_0-1705601094157.png

 

My formula is below:

 

With(
{
Items:
SortByColumns(
Search(
LocationData,
TextSearchBox.Text,
"Title"
),
"Distance", SortOrder.Ascending
)
},
ForAll(
Sequence(CountRows(Items)),
Patch(
Last(
FirstN(Items,Value)),
{ID: Value}
)

)
)

 

How to fix this and sort all records by Distance column from low to high 

  • PowerUser39 Profile Picture
    73 on 18 Jan 2024 at 20:57:43
    Re: PowerApps Gallery Sort not working properly
    Awesome it worked. Thank you! 🙂
  • Verified answer
    BCLS776 Profile Picture
    8,988 Super User 2025 Season 1 on 18 Jan 2024 at 19:24:34
    Re: PowerApps Gallery Sort not working properly

    Your app is sorting the distance column of the collection as a string, e.g. "100.56 mi" rather than the number 100.56.

     

    To get it working properly, consider adding a third column to your collection with the numeric value of the distance. Then, sort on that column.

     

    Hope that helps,

    Bryan

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 32

#2
Rajkumar_M Profile Picture

Rajkumar_M 16 Super User 2025 Season 1

#2
mmbr1606 Profile Picture

mmbr1606 16 Super User 2025 Season 1

Overall leaderboard