How does the COUNTROWS function (DAX) work?

The COUNTROWS function (DAX) counts the number of rows in the specified table, or in a table defined by an expression.

COUNTROWS Formula Syntax


How do you use the COUNTROWS function?

This function can be used to count the number of rows in a base table, but more often is used to count the number of rows that result from filtering a table, or applying context to a table.

Related Blog Posts

Related Support Forum Posts

If Is Blank in Countrows card visual
Using COUNTROWS but also managing many filters – DAX formula optimization
Using virtual tables with COUNTROWS

Considerations when using the COUNTROWS function

Whenever there are no rows to aggregate, the function returns a blank. However, if there are rows, but none of them meet the specified criteria, the function returns 0. Microsoft Excel also returns a zero if no rows are found that meet the conditions.

Related Video Tutorials

Formula examples using the COUNTROWS function



= COUNTBLANK (SalesTarget[SalesTarget])

Related DAX Functions

Related Course Modules

Center of Excellence


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.

Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide