COUNTX Function (DAX)

How does the COUNTX function (DAX) work?

The COUNTX function (DAX) is a statistical function that counts the number of rows with a non-blank value when evaluating an expression on a table.

COUNTX Formula Syntax


How do you use the COUNTX function?

This function is used to count a number of rows that are not blank and returns a whole number. It is used to count only number values, dates, or strings.

Related Blog Posts

Related Support Forum Posts

Dax calculation to sum based on criteria
Count Rows if the text contains a specific string
Forecasting using little amount of days

Considerations when using the function

The COUNTX function counts only numerical values or dates. Values that are logical or in text that cannot be translated into numbers are not counted. If there are no rows to count, it returns a blank. If there are rows but none meets the criteria, then the function returns 0.

Related Video Tutorials

Formula examples using the COUNTX function


=COUNTX(FILTER(Product,RELATED(ProductSubcategory[EnglishProductSubcategoryName])=”Caps”, Product[ListPrice])

= COUNTX (RELATEDTABLE (East_Sales), IF ([Product] = East_Sales[Product],1,0))

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