web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CountRows() does not u...
Power Apps
Unanswered

CountRows() does not update correctly

(2) ShareShare
ReportReport
Posted on by 40

Hi everyone,

 

Today we noticed something strange. Until a few weeks ago using a CountRows() to count all of the rows in a Dataverse table was no problem. Today we noticed that the quantity does not update.

 

We're trying to count all of the incidents in the incident table. 

CountRows(Aanvragen);

The amount returned is 2741:

WesleySmits_0-1665407299316.png

 

We remove one record using the following syntax 

Remove(Aanvragen, First(Aanvragen));

 This removes the first record from the incidents table. When we look again the quantity returned stays 2741.

 

However... when we use a CountIf() with all the possible Status codes the amount changes.

The initial quantity returned is 2721.

WesleySmits_1-1665407446821.png

 

Again, we remove the first record from the incidents table, what does the CountIf() do?

It updates the quantity:

WesleySmits_2-1665407510337.png

 

Does anyone know why the CountRows() doesn't work in this case? I remember it working before.

 

Thanks in advance for the answers!

Categories:
I have the same question (0)
  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @WesleySmits ,

     

    I did some experiments on my side and found the exact same issue as you.

     

    "CountRows()" seems to lag when counting the rows of an updated table, but "CountIf()" doesn't have this problem.

     

    I tried refreshing the database from PowerApps to no avail.

     

    Unfortunately, I don't know why it behaves this way. I recommend reporting this bug to Microsoft and keep using "CountIf()" until it's fixed.

  • msabau Profile Picture
    270 on at

    I always get my data with ClearCollect.

    I usually have a ClearCollect on App.OnStart and in the screens that I need the data on the OnVisible property, that way I'm sure that the data I get is up to date as the Refresh() funtion doesn't seem to do anything.

    ClearCollect(FictionalName, YouDataSourceName)

    Then of course you should use the name you used in the ClearCollect() function in your app

  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    Try the Count() funct instead of CountRows() if you are still getting the issue!
    Both count and countrows seems to be working for me

  • WesleySmits Profile Picture
    40 on at

    Hi everyone,

     

    Thank you for the replies.

    I created a ticket with Microsoft and this is what they had to say about it (in case of a delegation warning):

     

    To bypass this issue, you need to enable the following feature on your app (By selecting Settings > Upcoming features > Preview😞

     

    WesleySmits_0-1665557151133.png

     


    If you already have this option enabled, please note that if you use the CountRows(<Data Source>) function 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).

     

    From now on I use CountIf(<Data Source>, true), that way I get the total count of all records and there is no caching issues.

  • Len C Profile Picture
    379 on at
    Two years later, I am having this same issue.  Worse, it doesn't seem to be about client-side caching. 
     
    For two hours, the row counts are not updating.  This despite many turns of exiting and re-entering the Canvas designer; removing the data source from the app and re-adding; refreshing the entire browser page, etc.
     
    There is no 'enhanced delegation' feature any more to turn on.
     
    I am verifying my table row counts using a model-driven app, plus Power BI desktop.
     
    Where is this caching taking place?  It must be on the back-end API's that the Canvas apps connects to?
  • Suggested answer
    Len C Profile Picture
    379 on at
    Oh...they've documented this now:
     
     
     
    • 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).

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard