Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

How to count the number of items in a collection ?



There is a function to count the number of items which are in a collection?




Thanks, I'll definitely have to stay with Sharepoint List for now since we don't have premium sub for Dataverse, besides we're looking at 120+ users on a daily basis so going premium connector will be prohibitively expensive. 

@Tazui1982 @Tazui 


Although I do not recommend rushing to move to Dataverse for just this reason, you should make a note of this setting in Canvas App Enhanced delegation for Microsoft Dataverse . Notice how this is set to On by default! Notice also how it states that CountRows is delegable to Microsoft Dataverse (with some caveats)



It states that:

"The following functions are delegated to Microsoft Dataverse: CountRows, CountIf, AsType, and the ;in' (membership) operator."

So, this may be something to consider or keep in mind in case it helps.

I don't recommend you to rush to move to Dataverse for only this reason.

However, I wanted you to keep it in mind in case so you could be informed.


You should note the caveats as well, there is a catch to the CountRows delegation.


  • There is a 50K delegation limit if you use CountRows and CountIf functions with filters. There is no hard limit on the CountRows function when extracted directly from the data source because of the cached count that Dataverse keeps.
  • If the CountRows(<Data Source>) function is used without filtering, the count might not be 100% accurate, because the cached count updates periodically. If you need precise count and expect the result to be under the aggregate limit, you can bypass the cached count via CountIf(<Data Source>, True).


Essentially, the caveats stated above mean something like this:


1. There is a reference to a limit of 50,000 Records when using CountRows with any Filters, this is because 50,000 is the maximum number of records that can be returned by the underlying implementation when querying against Dataverse in that specific way.


2. If using CountRows on, for example, a whole Dataverse table directly, such as like this: CountRows(myDataverseTable), then there is "no limit", - however, there's a catch -  note that the underlying implementation may be using a cached count that is updating periodically - so there may be cases where the actual count returned may not be exact at the moment of calling this function. In some cases, this is fine. In other cases, this may not be desirable.


3. You can use CountIf(myDataverseTable,true) to get a more exact count and bypass the cached count. However, note that doing this will also trigger the 50,000 Record limit, so if there are more than 50,000 Records when calling CountIf(myDataverseTable,true), it will always return the number 50,000 in that case. 


For this reason I don't recommend to use this as the sole justification to move to Dataverse, or to rush moving to Dataverse at all, instead you should probably stick with SharePoint List for now, but you should still make a note of this about Dataverse in case you want to consider it.

Thank you, I will def keep this tip in my mind for future.

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,879)