COUNT
The number of a column's values that are not blank; a column of TRUE and FALSE is an error (use COUNTA).
Group: Aggregation. Compatible with DAX.
Syntax
COUNT ( <column> )
| Parameter | Type | Description |
|---|---|---|
column | Column | The column whose values are counted. |
Returns
Whole number. How many of the column's cells are not blank in the current filter context.
Remarks
- Numbers, dates and text are counted alike; a column of TRUE and FALSE values is an error, for which
COUNTAis meant. - When nothing is counted, the result is BLANK, not 0. Add 0 (
COUNT ( ... ) + 0) where a zero should show. - To count the rows of a table, blanks or not, use
COUNTROWS; to count the different values,DISTINCTCOUNT.
Examples
Holdings with a price
Two of the five holdings have no quoted price.
EVALUATE
ROW (
"With a price", COUNT ( Holdings[Price] ),
"Holdings", COUNTROWS ( Holdings )
)
| With a price | Holdings |
|---|---|
| 3 | 5 |
A text column counts too
EVALUATE
ROW ( "Products", COUNT ( Products[Product] ) )
| Products |
|---|
| 4 |