Showing results for 
Search instead for 
Did you mean: 
Not applicable

Delegation Warning



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.




Super User
Super User

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.

Hardit Bhatia
Dual Super User
Dual Super User

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.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support
Community Support

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:


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


Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,826)