COUNTA DAX Function (Aggregation)
Counts the number of values in a column.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| ColumnName |
The column that contains the values to be counted. |
Return values
Returns the number of cells in a column that contain a non blank value.
Remarks
The only argument allowed to this function is a column.
When the function finds no rows that are non-blank, it returns a blank.
COUNT and COUNTA are identical in DAX for all the data types except Boolean. COUNTA can operate on a Boolean data type, whereas COUNT cannot do that.
The COUNTA function internally executes COUNTAX, without any performance difference.
The following COUNTA call:
COUNTA ( table[column] )
corresponds to the following COUNTAX call:
COUNTAX (
table,
table[column]
)
Examples
-- COUNT ( table[column] ) is a short version of COUNTX ( table, table[column] )
-- COUNT and COUNTA return the same result, but only COUNTA can count
-- a Boolean column: COUNT returns an error on a Boolean column
-- COUNTX can be expressed in a more explicit way by using CALCULATE
-- and COUNTROWS
DEFINE
MEASURE Customer[# Customers] = COUNTROWS ( Customer )
MEASURE Customer[# Individuals 1] = COUNT ( Customer[Customer Name] )
MEASURE Customer[# Individuals 2] = COUNTX ( Customer, Customer[Customer Name] )
MEASURE Customer[# Individuals 3] =
CALCULATE (
COUNTROWS ( Customer ),
NOT ISBLANK ( Customer[Customer Name] )
)
EVALUATE
SUMMARIZECOLUMNS (
Customer[Continent],
"# Customers", [# Customers],
"# Individuals 1", [# Individuals 1],
"# Individuals 2", [# Individuals 2],
"# Individuals 3", [# Individuals 3]
)
| Continent | # Customers | # Individuals 1 | # Individuals 2 | # Individuals 3 |
|---|---|---|---|---|
| Asia | 3,658 | 3,624 | 3,624 | 3,624 |
| North America | 9,665 | 9,527 | 9,527 | 9,527 |
| Europe | 5,546 | 5,525 | 5,525 | 5,525 |
-- COUNTA and COUNTAX can count a Boolean column
-- COUNT and COUNTX return an error with a Boolean column
EVALUATE
{
( "COUNTA ( Customer[NoCars] )", COUNTA ( Customer[NoCars] ) ),
( "COUNTAX ( Customer, Customer[NoCars] )", COUNTAX ( Customer, Customer[NoCars] ) ),
( "COUNTROWS ( Customer )", COUNTROWS ( Customer ) )
}
| Value1 | Value2 |
|---|---|
| COUNTROWS ( Customer ) | 18,869 |
| COUNTA ( Customer[NoCars] ) | 18,869 |
| COUNTAX ( Customer, Customer[NoCars] ) | 18,869 |
-- COUNT does not count blanks, but it counts empty strings
-- using the CALCULATE version, the code is clearer
DEFINE
MEASURE Customer[# COUNT] = COUNT ( Customer[Customer Name] )
MEASURE Customer[# NO BLANKS] =
CALCULATE (
COUNTROWS ( Customer ),
NOT ISBLANK ( Customer[Customer Name] )
)
MEASURE Customer[# NO BLANKS / EMPTY STRINGS] =
CALCULATE (
COUNTROWS ( Customer ),
Customer[Customer Name] <> ""
)
EVALUATE
SUMMARIZECOLUMNS (
Customer[Continent],
"# COUNT", [# COUNT],
"# NO BLANKS", [# NO BLANKS],
"# NO BLANKS / EMPTY STRINGS", [# NO BLANKS / EMPTY STRINGS]
)
| Continent | # COUNT | # NO BLANKS | # NO BLANKS / EMPTY STRINGS |
|---|---|---|---|
| Asia | 3,624 | 3,624 | 3,591 |
| North America | 9,527 | 9,527 | 9,389 |
| Europe | 5,525 | 5,525 | 5,504 |
Related functions
Other related functions are:
Last update: Nov 2, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
Microsoft documentation: https://docs.microsoft.com/en-us/dax/counta-function-dax