DAX function
DISTINCTCOUNT — DAX function reference
Count distinct values.
Syntax
dax
DISTINCTCOUNT(<column>)
Examples
dax
DISTINCTCOUNT(Sales[CustomerID])
→ A number
dax
CALCULATE(DISTINCTCOUNT(Sales[CustomerID]), Sales[Year] = 2026)
→ Distinct customers in 2026
dax
DIVIDE(DISTINCTCOUNT(Sales[CustomerID]), COUNTROWS(Sales))
→ Orders per distinct customer
Common mistakes & gotchas
- DISTINCTCOUNT excludes blanks; COUNTROWS(VALUES(column)) includes a blank row when present, so the two are not always interchangeable.
- It's a full column scan under the hood — on very high-cardinality columns (like GUIDs) at large row counts it can be noticeably slower than a pre-aggregated approach.
Related DAX functions
From Aggregations