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

COUNTX(
     ,
)

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

 

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(Product,[ListPrice])

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

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

Related DAX Functions

COUNT
COUNTA Function (DAX)
COUNTAX

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI