Count customers who bought bikes with CALCULATE and DISTINCTCOUNT
Count how many different customers bought at least one bike — and see why counting rows of the Customer table gives the wrong answer.
You will learn to
- Count distinct customers under a product filter
- Explain why a Product filter never reaches the Customer table
- Count from the fact table’s key column
How it works
To count **buyers** of something, count the different customer keys in the Sales rows that are left after filtering. `[Customers]` is `DISTINCTCOUNT(Sales[CustomerKey])`, so wrapping it in CALCULATE with a product filter counts the customers who bought those products.
Counting the Customer table itself doesn’t work. Filters flow from Product **down** to Sales, but never back **up** from Sales to Customer, so a Product filter leaves all 40 customers visible: `COUNTROWS(Customer)` ignores what they bought.
Counting rows of Sales has the opposite problem: it counts order lines, so a customer who bought three bikes is counted three times.
Practice it hands-on with a real data model and a live report that updates as you type.
Clothing Buyers = CALCULATE(DISTINCTCOUNT(Sales[CustomerKey]), Product[Category] = "Clothing")