Counting sounds simple, but each DAX counting function answers a different question.
- COUNTROWS(Table) counts the rows left in a table after the filters:
COUNTROWS(Sales) is the number of orders.
- DISTINCTCOUNT(Column) counts different values:
DISTINCTCOUNT(Sales[CustomerKey]) is the number of customers who bought.
- COUNTBLANK(Column) counts empty values, such as orders with no ship date yet.
- VALUES(Column) returns the distinct values as a table, so
COUNTROWS(VALUES(...)) also counts them.
Two traps. Counting a dimension table, such as COUNTROWS(Product), counts every product in the list, including one that never sold. And DISTINCTCOUNT treats a blank as one more value; use DISTINCTCOUNTNOBLANK to leave it out.