Short answer: in a period, a customer is new if their first purchase ever falls in that period, and returning if they bought in the period and had bought before it. Optionally split returning into active (bought in the last 12 months before) and reactivated (came back after a longer gap). Count customers and revenue in each group: a business growing only through new customers while returning revenue shrinks has a retention problem the total hides.
The split has to work for any period the reader picks: a month, a quarter, a custom range. That rules out a fixed "is new" column and calls for measures.
How does the split look?
- New
- Returning
- Reactivated
| Group | Customers | Revenue (k) | Revenue per customer |
|---|---|---|---|
| New | 2,480 | 310 | 125 |
| Returning (active) | 3,170 | 570 | 180 |
| Reactivated | 260 | 30 | 115 |
| All | 5,910 | 910 | 154 |
Total revenue grows slightly each quarter, but returning revenue falls from 610 to 570: growth depends on ever more new customers.
What is the DAX?
Each customer's first purchase ever is CALCULATE ( MIN ( Sales[Date] ), ALL ( 'Date' ) ) evaluated for that customer. For the selected period:
Customers = DISTINCTCOUNT ( Sales[Customer ID] )
New Customers =
VAR PStart = MIN ( 'Date'[Date] )
VAR PEnd = MAX ( 'Date'[Date] )
RETURN
COUNTROWS (
FILTER (
VALUES ( Sales[Customer ID] ),
VAR F = CALCULATE ( MIN ( Sales[Date] ), ALL ( 'Date' ) )
RETURN F >= PStart && F <= PEnd
)
)
Returning Customers = [Customers] - [New Customers]
New Customer Revenue =
VAR PStart = MIN ( 'Date'[Date] )
RETURN
SUMX (
VALUES ( Sales[Customer ID] ),
IF ( CALCULATE ( MIN ( Sales[Date] ), ALL ( 'Date' ) ) >= PStart, [Revenue] )
)
Returning Customer Revenue = [Revenue] - [New Customer Revenue]
New Customer Share = DIVIDE ( [New Customers], [Customers] )Inside the iterator, CALCULATE turns the current customer ID into a filter (context transition) and ALL ( 'Date' ) removes the period, so it returns that customer's first purchase ever. A calculated column on the Customer table, First Purchase Date = CALCULATE ( MIN ( Sales[Date] ) ), is the faster alternative on large data. For reactivated customers, add a test that the customer had no purchase in the 365 days before PStart:
Reactivated Customers =
VAR PStart = MIN ( 'Date'[Date] )
RETURN
COUNTROWS (
FILTER (
VALUES ( Sales[Customer ID] ),
CALCULATE ( MIN ( Sales[Date] ), ALL ( 'Date' ) ) < PStart
&& ISEMPTY (
CALCULATETABLE ( Sales, DATESBETWEEN ( 'Date'[Date], PStart - 365, PStart - 1 ) )
)
)
)Which definitions must be settled?
- What is "first purchase": the first order ever, or the first in this channel or brand?
- Returns: does a customer whose only order was returned count?
- Customer identity: guest checkouts and several accounts per person turn returning customers into new ones.
- Reactivation gap: 12 months suits most shops; use the buying cycle.
What goes wrong?
- A fixed "new" flag by calendar year. Breaks when the reader selects a quarter; compute per period.
- New customers in a long period. In a full year, someone who first bought in January and again in June is "new" for the year; that is correct for the year, but surprising next to monthly numbers.
- Data that starts late. If the history starts in 2024, every customer looks new in 2024; hide periods without a full look-back.
Where can you check this?
- Microsoft Learn: FILTER function (DAX)
- Microsoft Learn: ISEMPTY function (DAX)
- Microsoft Learn: DATESBETWEEN function (DAX)
Where do you start?
Build New Customers and New Customer Revenue and show new and returning revenue as a stacked column chart by quarter. Customer acquisition cost puts a price on each new customer.