web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    on at
    Re: How is it that the Common Data Service connector doesn't delegate CountRows()?

    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
    Re: How is it that the Common Data Service connector doesn't delegate CountRows()?

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard