COUNTAX Function (DAX)

How does the COUNTAX function (DAX) work?

The COUNTAX function counts nonblank results when evaluating the result of an expression.

COUNTAX Formula Syntax

COUNTAX(
     <table>,<expression>
)

How do you use the COUNTAX function?

The COUNTAX function is used to iterate through rows in a table as well as to count rows where the expression is a non-blank result. It counts cells that contain any type of information, including other expressions.

If the column has an expression of an empty string, the COUNTAX function will treat it as non-blank. Usually, it won’t count empty cells but since the cell contains a formula, the function will count it.

Related Blog Posts

 

Considerations when using the COUNTAX function

The COUNTAX can be used on a Boolean data type. If there are no rows that produce a non-blank value, the function will return a blank result.

COUNTAX and COUNTX are identical except for Boolean. COUNTAX can operate on a Boolean data type, but COUNTX cannot do that.

Related Video Tutorials

Formula examples using the COUNTAX function

=COUNTAX(FILTER(‘Reseller’,[Status]=”Active”),[Phone])

= COUNTAX ( FILTER (Results, Results[Season] = “Summer”), Results[Medal] )

= COUNTAX ( FILTER ( Orders, Orders[Customer ID] = EARLIER ( Orders[Customer ID] ) ), [Customer ID] )

Related DAX Functions

COUNT
COUNTA Function (DAX)
COUNTX

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI