How does the COUNTROWS function (DAX) work?

The COUNTROWS function (DAX)counts the number of rows within a Power BI table.

COUNTROWS Formula Syntax


How do you use the COUNTROWS function?

The COUNTROWS function is used to count the unique values in a column using the current filter context. It can also be used to check whether a column has only one item filtered/selected in the current context.

Related Blog Posts

Related Support Forum Posts

If Is Blank in Countrows card visual
Using COUNTROWS but also managing many filters – DAX formula optimization
Loyalty tracking

Considerations when using the COUNTROWS function

If a table has no rows, the function returns a blank. If there are rows but none of them has the specified criteria, the function returns 0.

Related Video Tutorials


Formula examples using the COUNTROWS function



= COUNTBLANK (SalesTarget[SalesTarget])

Related DAX Functions

Related Course Modules



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