Power Apps CountRows returns the number of records in a table, so CountRows(Filter('Service Requests', Status.Value = "Closed")) tells you how many closed requests you have. The catch: on SharePoint, the count is only right while the filter itself delegates.
In this tutorial, we’ll use the powerapps countrows function on a real 623-item SharePoint list and see which counts are right, which are silently wrong, and how to fix them.
Here’s the shortest working version. Put it in a label’s Text property:
"Closed requests: " & CountRows(
Filter('Service Requests', Status.Value = "Closed")
)
In my Service Desk Demo app, that label shows 206. It also shows a yellow delegation warning, which I’ll explain below.
Build the Demo App Step by Step
If you’ve never built a canvas app, follow these steps first. Our Power Apps tutorials cover every control in more detail.
1. Prepare the data. A data source is where the app reads records from. Mine is a SharePoint list called Service Requests with columns Title, Status, Priority, Requester and DueDate:

2. Open the maker portal. Go to make.powerapps.com and, on Home, find Start with design:

3. Start a blank canvas app. Select Create from blank:

4. Pick a layout. In Start with a blank canvas, choose Tablet:

5. Add the data. Select Add data, search for SharePoint and pick the SharePoint connector:

6. Connect to the site. Paste your SharePoint site URL and select Connect:

7. Choose the list. Check Service Requests and select Connect:

8. Add a label. Open the Insert menu and pick Text label. A label is a control that just shows text, which makes it the easiest place to see a count.
9. Type the formula. With the label selected, pick Text in the property dropdown to the left of the fx formula bar, then type the CountRows formula in the bar.
The value shows right away in the editor. To test buttons, select Play (top right) or hold Alt and click. Press Ctrl+S to save.
Power Apps CountRows Syntax
CountRows takes one argument and returns a number:
CountRows( Table )
Table is required. It can be a data source, a Filter() result, a collection or a gallery’s AllItems. CountRows doesn’t test any condition itself; it counts whatever table you hand it.
That’s why you’ll almost always wrap it around Filter(). The filter picks the rows, and CountRows counts them.
Delegation Warning: The “CountRows” Operation Is Not Supported by This Connector
Type any CountRows formula over a SharePoint list and Power Apps Studio adds a yellow triangle. Hover over the formula and you’ll see this exact text:
Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The "CountRows" operation is not supported by this connector.
Delegation means Power Apps sends the work to SharePoint instead of downloading rows. SharePoint can filter, sort and look up, but it can’t count. So CountRows always runs inside the app:

Here’s the part most posts miss. The warning above is on StartsWith(Title, "VPN"), and the count of 52 is still correct. The warning tells you CountRows runs locally, not that the number is wrong.
The number is right when the filter inside it delegates and returns no more rows than your data row limit (500 by default). If the filter doesn’t delegate, the count is wrong, and nothing else warns you.
Which CountRows Filters Give the Right Count?
To find out, I put seven CountRows labels on one screen, all over the same Service Requests list. The screen title says 620 items; the list now holds 623 (620 sample requests plus 3 test rows from another demo).

Every label has the warning, yet only some numbers are wrong. Here’s what each one does:
| Formula inside CountRows(Filter(…)) | Result | Right? |
|---|---|---|
StartsWith(Title, "VPN") | 52 | Yes, StartsWith delegates |
Status.Value = "Closed" | 206 | Yes, = on a Choice delegates |
DueDate >= Date(2026,9,1) | 82 | Yes, date comparison delegates |
"VPN" in Title | 42 | No, 53 titles contain VPN |
Not(IsBlank(Requester)) | 500 | No, capped at the row limit |
Requester <> Blank() | 500 | No, capped at the row limit |
Len(Title) > 0 | 500 | No, capped at the row limit |
The in operator is the sneakiest one. Power Apps underlines just in, checks only rows 1 to 500, and returns 42 instead of an error:

CountRows(Filter('Service Requests', "VPN" in Title))
If you need a contains-style match, the Power Apps Search function has the same limit. Use StartsWith when you can; our StartsWith and EndsWith guide shows which of the two delegates.
A round 500 is the giveaway. When a count lands exactly on your row limit, the filter didn’t delegate. Our Power Apps delegation guide lists the fixes for each column type.
Why Does CountRows Return 500 in Power Apps?
When a formula can’t delegate, Power Apps downloads only the first 500 rows and works on those. When I loaded the whole list with ClearCollect, CountRows(colRequests) returned 500 in my app.
That 500 is the Data row limit. You’ll find it under Settings > General in Power Apps Studio:

When I raised it to 2,000 and loaded the list again, the same count returned 623, the whole list.
Microsoft Learn now lists 1 to 10,000, but my Studio still stops at 2,000 (“This value needs to be between 1 and 2000”).
Higher limits slow the app down, so treat this as a stopgap. Our post on the Power Apps data row limit covers the trade-offs.
Pro Tip: while testing, set the limit to 1. Any count that isn’t delegated comes back as 1, so wrong formulas jump out before your users see them.
CountRows on a Collection
A collection is a table held in the app’s memory, so CountRows on it has no warning. Our guide to create a collection in Power Apps explains how to build one.
CountRows(colOrders)
My colOrders collection has 7 order lines, and that label shows 7.
The trap is how the collection got its rows. ClearCollect(colRequests, 'Service Requests') is not delegable, so it loads only 500 rows. CountRows then counts 500 correctly, and the answer is still wrong:

Loading in chunks fixed it. Each Status filter delegates and returns fewer than 500 rows, so all 623 requests arrive:
Clear(colAllRequests);
ForAll(
["New", "In Progress", "Closed"] As s,
Collect(colAllRequests, Filter('Service Requests', Status.Value = s.Value))
);
CountRows(colAllRequests)
Important: chunk by a column every row has. My by-month version returned 620, because the 3 test rows have no DueDate and no month filter matched them.
How Do You Count Rows in a Gallery With a Filter?
Count a gallery with its AllItems property, not the gallery name. I checked two boxes in my requests gallery, and this label showed 2:
"Checked in gallery: " & CountRows(Filter(galRequests.AllItems, chkPick.Value))
AllItems only holds rows the gallery has loaded. Galleries load more as you scroll, so for a list total, count the data source instead. Our post on how to count rows in a Power Apps gallery has more examples.
CountRows vs Count, CountA and CountIf
All four return a number, but they count different things:
| Function | What it counts | Example |
|---|---|---|
CountRows(Table) | Every record in a table | CountRows(colOrders) |
CountIf(Table, Formula) | Records where the formula is true | CountIf(colOrders, Region = "West") |
Count(Column) | Records that contain a number | Count(colOrders.Qty) |
CountA(Column) | Records that aren’t blank (empty text counts) | CountA(colOrders.Item) |
CountIf(Source, Condition) is shorter than CountRows plus Filter, but it isn’t on SharePoint’s delegable list either. See the Power Apps CountIf function and Count function in Power Apps for each one in depth.
For an exact count of a huge list, let SharePoint do it. A flow can return the total, as in our post on how to count items in a SharePoint list with Power Automate.
Want to go further with counting and filtering in Power Apps? These are worth a read:
Frequently Asked Questions
Is CountRows delegable to SharePoint in Power Apps?
No. SharePoint’s delegable list has no count functions, so CountRows always shows a delegation warning. The count is still correct when the Filter inside it delegates and returns no more rows than the data row limit.
Why does CountRows show 500 instead of the real number?
500 is the default data row limit. If the formula or its filter can’t delegate, Power Apps only looks at the first 500 rows. Use a delegable filter, load the data in chunks, or raise the limit in Settings > General.
How do I count rows in a SharePoint list with a filter?
Wrap a delegable Filter in CountRows, for example CountRows(Filter(‘Service Requests’, Status.Value = “Closed”)). Equals on a Choice column, StartsWith and date comparisons delegate; in, Not and Len don’t.
What’s the difference between CountRows and CountIf?
CountRows counts every record in the table you pass. CountIf takes a table and a condition and counts the records where the condition is true. On SharePoint, neither one delegates.
Where does Microsoft document CountRows?
Microsoft covers CountRows, CountIf, Count and CountA, with syntax and examples, in Count, CountA, CountIf, and CountRows functions.

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.
Please delete the “PowerApps countrows datatable” section in that you are not counting the number of rows in the Data table you are counting the number of rows in the underlying list. That is useless if you want to how many rows are in shown in your actual table (search/filtered). Also there is a delegation issue using the process you have described.
lovely cocepts clearance
Excellent article and great workaround for counting rows in a data table. That helped me while struggling with that error. Thanks.
The Collection trick doesn’t work. The ClearCollect(collectionname,SharePointlistname) also only stores the first 500 rows into the collection. So the Countrows function on the collection will also only return 500. You just get rid of the delegation warning but you don’t solve the problem