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 / Threshold Limits - Mul...
Power Apps
Answered

Threshold Limits - Multiple Levels of Gallery Sorting Doesn't Work After Indexing SharePoint Columns

(1) ShareShare
ReportReport
Posted on by 237

I have an app that is connected to a SharePoint List that has over 7000 items, with about 500 being added daily. The app basically serves as a work queue and has a few filters and sort functions. 

 

Before crossing the 5,000 item threshold, which caused errors with my app, my gallery/work queue "Items" property was the following:

SortByColumns(
Filter('Daily Picking Data - NEW DRAFT','Material Needed'.Value = "Yes" && Fulfillment.Value = "Review Needed" && Cancellation.Value = Blank()),
"SO_x0023_", Ascending, "WO_x0023_", Ascending, "Part_x0020_Number", Ascending, "Created", Descending)

 

Everything was great until we crossed the 5,000 item limit threshold. At that time, I quickly learned that I needed to index the columns that I was using to filter and sort in SharePoint. I did this and then everything worked just fine.

 

When I woke up the next day, I was getting the threshold errors yet again. However, If I removed all but one of the "Sorts" that I had, everything would work.

 

I am now utilizing the following in my "Items" property:

 

SortByColumns(
Filter('Daily Picking Data - NEW DRAFT','Material Needed'.Value = "Yes" && Fulfillment.Value = "Review Needed" && Cancellation.Value = Blank()),
"SO_x0023_", Ascending)

 

Does anyone have any suggestions as to why everything would have worked after I initially indexed the SharePoint columns, but failed the next day, but will work with only one level of sorting? I have another app that encountered this issue and also has multiple levels of sorts and everything works just fine in that app.

 

I hoping to learn how to avoid this issue in the future.

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mkusler ,

     

    Could you please share the error message of threshold? Cause I have never run into this kind of scenario before.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • mkusler Profile Picture
    237 on at

    @v-jefferni 

     

    This is what I get after adding one sort criteria (which previously had worked).

     

    Threshold.JPG

  • VegetA3113 Profile Picture
    32 on at
    I just found this post after hours of trying to find a solution. All my columns that form part of my powerApp filtering is fully indexed but the issue persists. I have three sort levels “WeekEndingDate”,Descending,”DutyDate”,Ascending,”DutyStart”,Ascending Funny enough the error disappears when I remove two of the sort formulas. The problem is I need al three of the sort formulas. Is there a workaround?
  • VegetA3113 Profile Picture
    32 on at
    I just found this post after hours of trying to find a solution. All my columns that form part of my powerApp filtering is fully indexed but the issue persists. I have three sort levels “WeekEndingDate”,Descending,”DutyDate”,Ascending,”DutyStart”,Ascending Funny enough the error disappears when I remove two of the sort formulas. The problem is I need al three of the sort formulas. Is there a workaround?
  • mkusler Profile Picture
    237 on at

    @VegetA3113 

     

    I never did figure out what was causing the error. For my situation, I ended up adding a search box which was far more useful to narrow down my results and then I only applied one-level of sorting. Everything works just fine, but that is obviously for my use case.

     

    Sorry I couldn't be of more help!

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @mkusler

    With({dpd:Filter('Daily Picking Data - NEW DRAFT','Material Needed'.Value = "Yes" && Fulfillment.Value = "Review Needed" && Cancellation.Value = Blank())},
    Sort(Sort(Sort(Sort(dpd, SO_x0023_) ,WO_x0023_), Part_x0020_Number),Created, Descending)

    )

  • VegetA3113 Profile Picture
    32 on at

    It works! You’re a genius!

     

    So basically SortByColumns doesn’t seem to work with multiple levels of sort when the Sharepoint list threshold (5000) has been breached.


    Incase anyone else has different sort directions at the end, this is what I did:

     

    Sort(Sort(Sort(OMT,DutyStart,Ascending),DutyDate,Ascending),WeekEndingDate,Descending))

     

    Also the order of filtering is reversed so the first filtered column is at the end of the nested sort.

     

    Could the post creator mark the above answer as solved.

  • mkusler Profile Picture
    237 on at

    @Drrickryp 

     

    Very cool! Thank you.

  • Sachin31 Profile Picture
    55 on at

    @VegetA3113 , @Drrickryp  what if we have conditions for each sort column for ascending or descending. i got this scenario

     

    Sort(
     Sort(
     Sort(
     Sort(var1, Created, SortOrder.Ascending),
     CompetitionId,
     SortOrder.Ascending
     ),
     ApplicationID,
     SortOrder.Ascending
     ),
     Title,
     SortOrder.Ascending
    )

     

     

     

     If(
     varSortDescending1,
     SortOrder.Descending,
     SortOrder.Ascending
     ),

     

     

    there is condition for other 3 columns as well,  Please advise how to arrange it for nested sort  

  • mychau Profile Picture
    56 on at

    same issue here when my SharePoint list is over 5K records. the marked solution is cool but not delegable, as it only returns the result of 500 items in my gallery. is there any other approach?

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

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard