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 Apps
Unanswered

Delegation Warning

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I'm trying to display the count of ID field in a label as text in an application. The application currently has more than 2000 records but now the count is struck at 2000 as i have set the delegation limit to 2000. 

 

Is there a way i can modify countrows() function to overcome this delegation issue or can anyone suggest a better alternative so that count will be displayed even after 2000 is exceeded.

 

Any sort of help will be greatly appreciated.

 

Regards

Srinath

Categories:
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    If there is a way for you to collect all the records in a collection, then you can use CountRows on the collection. That being said, Collect and ClearCollect are also subject to the non-delegation limit. So if there is a way for you to break down your data into chunks that are smaller than 2000, you can collect them in multiple collections and then combine those collections into one.

    Let me know if this sounds a workable approach.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Hardit Bhatia
    https://thepoweraddict.com
  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    I'm assuming that you are using SharePoint as a data source.  If that is the case there really is no way to avoid the delegation issue and get a count of the number of rows in the entire data source.  The only way to do it is to find a way to filter the data source into smaller chunks that are less than 2,000 items and page through each of those filtered lists and get a sum total from them.

     

    For example, I have one demo where I filter a 5,000 record list by the first letter of the title and copy the records to a collection. I run that Collect() statement 26 times, once for each letter in the alphabet. When its done I have a collection with all the records in it.  It works, but performance is slow for that many records and it really isn't worth it outside of a demo.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Based on the needs that you mentioned, I afraid that there is no way to achieve your needs in PowerApps currently.

     

    The CountRows() function is a Non-Delegable function in PowerApps, which would be subject to 2000 Delegation limits. As an alternative solution, you could consider bulk-load your data source records into a collection in your app, then use the collection as data source in your app instead of original data source. Then you could apply the CountRows() function to the collection.

     

    Please check and see if the following threads would help in your scenario:

    https://powerusers.microsoft.com/t5/General-Discussion/Pulling-in-large-ish-SQL-tables/m-p/243777#M71518

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Loading-60-000-SharePoint-List-Items/m-p/448633/highlight/false#M133427

    https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Sort-gallery-with-multiple-fields/td-p/379730

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Delegation-Formula-Help/m-p/394039#M115089

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard