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 / Un-expected results us...
Power Apps
Answered

Un-expected results using Sort function

(0) ShareShare
ReportReport
Posted on by 29

Hi All,

 

When working on my current PowerApp I've encountered some issue's with the Sort and SortByColumns function and I was hoping to find some feedback to fix this.

I have a SharePoint list as a source for my Gallery, when sorting by any autogenerated column (ID,modified,created) I get results from the Sort function, however, when trying the same with my "added_by" column (single line of text), I get 0 results.

 

The formula's in question:

Sort(expenses2,Modified,SortOrder.Ascending) - Works as expected

Sort(expenses2,added_by,SortOrder.Ascending) - 0 results

 

Does anyone know how to fix this?

 

 

Categories:
I have the same question (0)
  • Chris-D Profile Picture
    1,246 on at

    Hi @Elke, this is confusing because no matter what the result of the sort, you should still get a complete list of 'expenses2'. 

     

    Can you add some screenshots please to demonstrate? 

  • SpongYe Profile Picture
    5,909 Super User 2026 Season 1 on at

    Hi @Elke 

     

    I just recreated your scenario and everything works fine:

    SpongYe_0-1695291370553.png

     

    SpongYe_1-1695291386234.png

    SpongYe_2-1695291396827.png

    The Sort doesn't effect the data. 

    The Sort function sorts a table based on a formula. The formula is evaluated for each record of the table, and the results are used to sort the table. The formula must result in a number, a string, or a Boolean value; it can't result in a table or a record.

     

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

     

  • tareqrosul Profile Picture
    164 on at

    This is working as it should be 
    added_by column has the values Piet and Jan
    if it is sorted as Ascending order the J should come first the P 
    add another label on the gallery and 

    ThisItem.added_by

    you should be able to see what's happening 
    If my response was beneficial to you, feel free to leave a 👍 symbol. If it effectively resolved your query, please signify with a 👍 and mark it as the Solution, assisting other community members in locating this helpful information more readily.

  • Elke Profile Picture
    29 on at

    Elke_0-1695292819897.png

    Thats weird when putting 2 galleries side by side with just these formulas, no errors either. The column is of a string type too.

    The only reason I could think of is delegation since the datasource is over 10k items, however I think Sort should be delegatable.

  • Elke Profile Picture
    29 on at

    Hey I;ve just done this, however the second gallery returns no results:

    Elke_1-1695293092077.png

     

  • Elke Profile Picture
    29 on at

    Slight update, I've just tried using the sort on a collection of the same data and it works as expected.

    Could this be an issue with how my sharepoint list is configured?

     

  • Verified answer
    timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    Hi @Elke 

    What I'd suggest is to create a SharePoint index on your added_by column. Hopefully, you'll receive more accurate results after you do that.

    https://support.microsoft.com/en-gb/office/add-an-index-to-a-list-or-library-column-f3f00554-b7dc-44d1-a2ed-d477eac463b0

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard