COUNTX Function (DAX)

How does the COUNTX function (DAX) work?

The COUNTX function (DAX) counts the number of rows that contain a non-blank value or an expression that evaluates to a non-blank value, when evaluating an expression over a table.

COUNTX Formula Syntax

COUNTX(
     ,
)

How do you use the COUNTX function?

The COUNTX function is used to count only number values, dates, or strings.

Related Blog Posts

Related Support Forum Posts

Count Zero stock occurrences and time product is out of stock
Average per quarter
Filter out customers who don’t buy certain products

Considerations when using the function

The COUNTX function takes two arguments. The first argument must always be a table, or any expression that returns a table. The second argument is the column or expression that is searched by COUNTX.

If the function finds no rows to count, it returns a blank.

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

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.