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 / PreFiltering performance
Power Apps
Answered

PreFiltering performance

(0) ShareShare
ReportReport
Posted on by 207

Hi All , Because of the 2000 limitation so I have a per-filtering collection loading when the button on click. Have any method can improve the performance on the collection loading. 

ClearCollect(ItemDetailFilter1, Filter(ItemDetails, Index <=2000),Filter(ItemDetails, Index >2000 && Index <=4000),Filter(ItemDetails, Index >4000 && Index <=6000),Filter(ItemDetails, Index >6000 && Index <=8000),Filter(ItemDetails, Index >8000 && Index <=10000),Filter(ItemDetails, Index >10000 && Index <=12000),Filter(ItemDetails, Index >12000 && Index <=14000),Filter(ItemDetails, Index >14000 && Index <=16000),Filter(ItemDetails, Index >16000 && Index <=18000),Filter(ItemDetails, Index >18000 && Index <=20000),Filter(ItemDetails, Index >20000 && Index <=22000),Filter(ItemDetails, Index >22000 && Index <=24000),Filter(ItemDetails, Index >24000 && Index <=26000),Filter(ItemDetails, Index >26000 && Index <=28000),Filter(ItemDetails, Index >28000 && Index <=30000));
ClearCollect(ItemDetailFilter,SortByColumns(SortByColumns(GroupBy(ItemDetailFilter1,"cr5e8_style","cr5e8_autotagpriceact","cr5e8_jaxgoldcontentid","cr5e8_jaxstonetypedescriptionen","cr5e8_jaxstonetype2descriptionen","cr5e8_itemname","cr5e8_jaxstonetypeid","cr5e8_itemtype","cr5e8_rank","cr5e8_ranklast6","cr5e8_itemstyle","cr5e8_availordered","cr5e8_mainstonetype","cr5e8_totalstonewt","cr5e8_totalsidediawt","cr5e8_centerdiamondwt","Group"),"cr5e8_style",SortOrder.Ascending), "cr5e8_itemtype",SortOrder.Descending));

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    Hi @abc3 ,

    Assuming here Index (not a good name as it is a Reserved Word for a Power Apps Function) is a sequential numeric column, then try this

    Clear(ItemDetailFilter1);
    With(
     {
     wSets: 
     With(
     {
     wLimits: 
     With(
     {
     wLimit: 
     Sort(
     ItemDetails,
     Index,
     Descending
     )
     },
     RoundDown(
     First(wLimit).Index / 2000,
     0
     ) + 1
     )
     },
     AddColumns(
     RenameColumns(
     Sequence(
     wLimits,
     0,
     2000
     ),
     "Value",
     "LowID"
     ),
     "HighID",
     LowID + 2000
     )
     )
     },
     ForAll(
     wSets As MaxMin,
     Collect(
     ItemDetailFilter1,
     Filter(
     ItemDetails,
     Index > MaxMin.LowID && Index <= MaxMin.HighID
     )
     )
     )
    );

    however collecting 30k records is never going to be anything but a slow process and subsequently any queries / manipulation of this is going to be also slow. For the second part, you can combine the SortByColumns, but other than that, if you want that structure, what you have would be the way to do it.

    ClearCollect(
     ItemDetailFilter,
     SortByColumns(
     GroupBy(
     ItemDetailFilter1,
     "cr5e8_style",
     "cr5e8_autotagpriceact",
     "cr5e8_jaxgoldcontentid",
     "cr5e8_jaxstonetypedescriptionen",
     "cr5e8_jaxstonetype2descriptionen",
     "cr5e8_itemname",
     "cr5e8_jaxstonetypeid",
     "cr5e8_itemtype",
     "cr5e8_rank",
     "cr5e8_ranklast6",
     "cr5e8_itemstyle",
     "cr5e8_availordered",
     "cr5e8_mainstonetype",
     "cr5e8_totalstonewt",
     "cr5e8_totalsidediawt",
     "cr5e8_centerdiamondwt",
     "Group"
     ),
     "cr5e8_style",
     SortOrder.Ascending, 
     "cr5e8_itemtype",
     SortOrder.Descending
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • abc3 Profile Picture
    207 on at

    Hi @WarrenBelz ,

    Thank you for your  help. I trying your code but after I copy code to my powerapps it having error 

    2023-06-19 09_58_29-Power Apps.png

    I found out why having the error thank your help 

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard