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 : 6CC2T4uG9GusHddoCO/dqO
Power Apps - Building Power Apps
Unanswered

How to solve Delegation issues for countRows in Power Apps?

Like (0) ShareShare
ReportReport
Posted on 23 May 2023 03:14:28 by 23

Datasource : sharepoint List

 

I would like to display a number of records that having few condition such as :-

1. Pending Request (Total)

2. Records with Active status (total) 

 

current formula for button is :- 

 

CountRows(
Filter(
'Employee',
Status = "Active" && ('Approval Status' = "Approved" || 'Approval Status' = "Pending") 
)
)

 

Question : 

1. How can i display records as it will have more than 2000 rows and i need this total to be counted and display on first screen for my application canvas thanks. i am new here

Categories:
  • EddieE Profile Picture
    4,641 Moderator on 23 May 2023 at 04:10:56
    Re: How to solve Delegation issues for countRows in Power Apps?

    @Anne98 

    The only way to use CountRows() on more than 2,000 records is to create a collection with all of your required records. One way to do this would be to think of your data in chunks that are less than 2,000 records in size.

     

    For example, if each record has a Date field and a chunk of records for a 6 months period never has more than 2,000 records in it then you could create this 4,000 record collection

     

    // First six months of 2023
    ClearCollect( colFirstSixMths, Filter( myData, dateField >= DateValue("01/01/2023") && dateField <= DateValue("06/30/2023") ) );
    
    // Last six months of 2023
    ClearCollect( col2ndSixMths, Filter( myData, dateField >= DateValue("07/01/2023") && dateField <= DateValue("12/31/2023") ) );
    
    // Combine collections
    ClearCollect( colAllYear, colFirstSixMths, col2ndSixMths)
    

    Change 

    - myData to the name of your data source, and

    - dateField to the name of your Date Field/Column

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 23 May 2023 at 04:06:52
    Re: How to solve Delegation issues for countRows in Power Apps?

    Hi @Anne98 ,

    CountRows is simply not Delegable - you can do this

    With(
     {
     wData:
     Filter(
     'Employee',
     Status = "Active" && 
     (
     'Approval Status' = "Approved" || 
     'Approval Status' = "Pending") 
     )
     )
     },
     CountRows(wData)
    )

    or to split it up to maximum of 2,000 each

    With(
     {
     wData1:
     Filter(
     'Employee',
     Status = "Active" && 
     'Approval Status' = "Approved"
     ),
     wData2:
     Filter(
     'Employee',
     Status = "Active" && 
     'Approval Status' = "Pending"
     )
     },
     CountRows(wData1) + CountRows(wData2)
    )

    but that is the best you will do without getting involved in a big collection (refer this blog of mine)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on 23 May 2023 at 04:04:57
    Re: How to solve Delegation issues for countRows in Power Apps?

    What is the datasource for these items?

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete