COUNTAX Function (DAX)

How does the COUNTAX function (DAX) work?

The COUNTAX function (DAX) counts nonblank results when evaluating the result of an expression over a table. It is used to iterate through the rows in a table and count rows where the specified expressions results in a non-blank result.

COUNTAX Formula Syntax

COUNTAX(
     <table>,<expression>
)

How do you use the COUNTAX function?

The COUNTAX function counts cells containing any type of information, including other expressions.

For example, if the column contains an expression that evaluates to an empty string, the COUNTAX function treats that result as non-blank. Usually the COUNTAX function does not count empty cells but in this case the cell contains a formula, so it is counted.

Related Blog Posts

Related Support Forum Posts

Understanding DAX Formula Developing Complex Dax functions How to count text values in Power BI like COUNTA in excel Groupby or Summarize

Considerations when using the COUNTAX function

The COUNTAX can operate on a Boolean data type. Whenever the function finds no rows to aggregate, the function returns a blank.

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

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