Count customers above a target with FILTER and a measure
Count how many customers spent $5,000 or more in each region, and see why a measure inside FILTER is what makes it work.
You will learn to
- Filter a dimension table by a measure
- Explain why a column aggregation inside FILTER gives the wrong answer
- Count the rows that pass with COUNTROWS
How it works
FILTER is an iterator too. `FILTER(Customer, condition)` tests the condition once per customer and keeps the rows where it is true.
When the condition uses a **measure**, context transition turns the current customer into a filter, so `[Total Sales]` means that customer’s sales. That is how you ask a per-customer question, such as “who spent at least $5,000?”
A plain aggregation like `SUM(Sales[Amount])` has no context transition. Inside FILTER it returns the total for the whole cell on every row, so either every customer passes or none do.
Wrap the filtered table in `COUNTROWS` to count the survivors.
Practice it hands-on with a real data model and a live report that updates as you type.
Strong Months = COUNTROWS(FILTER(VALUES('Date'[Month Year]), [Total Sales] >= 20000))