New vs returning customers: count returning customers per month
Count the customers who bought in a month and had already bought before it, by comparing each buyer’s first purchase date with the start of the period.
You will learn to
- Capture the start of the period in a variable
- Test each customer’s first purchase date inside FILTER
- Count only customers who bought in the period
How it works
Every customer who buys in a month is either **new** (this is their first purchase ever) or **returning** (they bought before). The split tells you whether growth comes from winning customers or from keeping them.
With a **First Purchase** measure in the model, the test is a comparison: a buyer is returning when their first purchase is **before** the period starts. Capture the start once with `VAR PeriodStart = MIN('Date'[Date])`, then walk the customers with `FILTER(Customer, …)`.
Two conditions must hold for each customer: they bought in the period (`NOT ISBLANK([Total Sales])`), and `[First Purchase] < PeriodStart`. Without the first test you would count every old customer, including the ones who didn’t buy this month.
Practice it hands-on with a real data model and a live report that updates as you type.
Early Customers Buying Now =
VAR Cutoff = DATE(2024, 3, 1)
RETURN COUNTROWS(FILTER(Customer, NOT ISBLANK([Total Sales]) && [First Purchase] < Cutoff))