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 / How is it that the Com...
Power Apps
Unanswered

How is it that the Common Data Service connector doesn't delegate CountRows()?

(0) ShareShare
ReportReport
Posted on by 33

CountRows() would be the first function any database implements.

Using the Common Data Service connector generates warning that the CountRows() function can't be delegated.

Seems like this must be a bug, yes?

I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @dave-jorgensen1 :

    Unfortunately, this is not a bug.Accourding to documentation:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

    Counting functions such as CountRowsCountA, and Count can't be delegated.

    If you nee  CountRows to be delegabe,I suggest you post your suggestion in this forum:

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

    In addition,I have some alternatives to circumvent the delegation problem:

    Solution1:Use calculation functions

    If your entity has a required numeric field, you can use the following formula to calculate the number of items:

    Sum(EntityA,NumberFiled)/Average(EntityA,NumberFiled)

    Solution2:Use Collect() to save records into a collection in batches (less than 2000 each time), and then use countrows() to calculate the number of records in the collection.For example:

    suppose you are collecting data from several areas and that each area you never collect over 2k records.  

    1\Add a button and set it's OnSelelct property to:

    Clear(TheCollection);
    Collect(TheCollection,Filter(yourentity,area="A"));
    Collect(TheCollection,Filter(yourentity,area="B"));
    Collect(TheCollection,Filter(yourentity,area="C"));

    2\Using CountRows to get the number of rows

    CountRows(TheCollection)

    Best Regards,

    Bof

     

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @dave-jorgensen1,

    To supplement on the previous post, careful with the Collect/CountRows especially if your entity contains a lot of records (>5000) you might have a performance impact and not get the actual counts. Consider this tip to the the total count of an entity: https://crmtipoftheday.com/1375/get-record-count-for-entities/

    or can use Power Automate for more complex logic: https://powerusers.microsoft.com/t5/Common-Data-Service-for-Apps/number-of-items-in-a-Common-Data-Service-entity/m-p/680133

    Hope this helps...

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 93 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
Valantis Profile Picture

Valantis 49

Last 30 days Overall leaderboard