Returns how many rows are in a table or a table expression. When counting rows is the goal, this DAX function is the recommended choice over COUNT.
Read more: Microsoft Learn
In the Ultra Transcenders books
Each book explains COUNTROWS in context, with comparison tables and the common traps.
Terms in this definition
- RETURNS
States what a function gives back, as a type or a table, inside
CREATE FUNCTION. SQL functions can leave it out and have the type worked out from their body. - Event
Table in Log Analytics where entries from Windows event logs are kept.
- DAX
Short for Data Analysis Expressions, the formula language you write measures, calculated columns and row-level security rules in, within tabular semantic models in Power BI, Excel Power Pivot or Analysis Services.
- FUNCTION
Registered models count as functions in Unity Catalog, so this securable type governs them too: access is given through
GRANT ... ON FUNCTION, and REST calls passFUNCTIONassecurable_type. - OVER
Gives a T-SQL window function its window: PARTITION BY, ORDER BY and, if wanted, a ROWS or RANGE frame. Rankings and running totals can then be worked out while every row is kept.
- COUNT
A DAX function returning how many non-blank numbers, dates or text values a column contains. Boolean columns need COUNTA instead, and for counting the rows of a table COUNTROWS is the better choice.