Sales from customers who bought a certain product

Add up everything bought by customers who bought a Touring-100 — FILTER over Customer with CALCULATE inside to test each customer’s purchases.

You will learn to

  • Select customers by what they bought
  • Use CALCULATE inside FILTER to test one customer at a time
  • Add up all of those customers’ sales, not just the product in the test

How it works

“How much do our Touring-100 owners spend in total?” is a question about **customers**, so filter the Customer table: keep each customer who has Touring-100 sales, then add up **all** of their sales.

The test inside FILTER needs CALCULATE. FILTER walks Customer one row at a time, but a row on its own is not a filter. Wrapping the test in `CALCULATE( )` turns the current customer into a filter (context transition), so the test sees only that customer’s sales. A measure reference such as `[Total Sales]` does this for you, because every measure has a hidden CALCULATE around it.

Without that step, a test like `COUNTROWS(FILTER(Sales, …)) > 0` looks at **everyone’s** sales for every customer, and every customer passes.

Practice it hands-on with a real data model and a live report that updates as you type.

Helmet Buyer Customers = COUNTROWS(FILTER(Customer, CALCULATE([Total Sales], Product[Product] = "Sport Helmet") > 0))