DAX Aggregation - COUNTAX function



Description

Counts nonblank results when evaluating the result of an expression over a table. That is, it works just like the COUNTA function, however it is used to iterate through the rows in a table and count rows where the specified expressions result in a nonblank result.

Syntax

COUNTAX (<table>, <expression>)

Parameters

Sr.No. Parameter & Description
1

table

The table containing the rows for which the expression will be evaluated.

2

expression

The expression to be evaluated for each row of the table.

Return Value

A whole number.

Remarks

The COUNTAX function counts the 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 nonblank. Usually, the COUNTAX function does not count empty cells but in this case the cell contains a formula, so it is counted.

Whenever the function finds no rows to aggregate, the function returns a blank. However, if there are rows, but none of them meet the specified criteria, the function returns 0.

Example

Medal Count Summer Sports:= COUNTAX ( 
   FILTER (Results, Results[Season] = "Summer"), Results[Medal]
) 
dax_functions_aggregation.htm
Advertisements