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

Related Support Forum Posts

Filter Out Customers Who Don’t Buy Certain Products Dax Command for Returning Frequency of Boolean (true/false) Values Visual Has Exceeded Available Resources

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

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


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
Membership