Share via


COUNTAX Function (DAX)

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

COUNTAX(<table>,<expression>)

Parameters

Term

Definition

table

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

expression

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

Return Value

A number (I8).

Remarks

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

If you do not need to count logical values or text, use the COUNTX function instead.

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. Microsoft Excel also returns 0 if no rows are found that meet the condition.

Example

The following example counts the number of nonblank rows in the column, Phone, using the table that results from filtering the Reseller table on [Status] = Active.

=COUNTAX(FILTER('Reseller',[Status]="Active"),[Phone])

See Also

Other Resources

COUNT Function (DAX)

COUNTA Function (DAX)

COUNTAX Function (DAX)

COUNTX Function (DAX)

Statistical Functions (DAX)