Project · Customer segments
Finding the 30% of customers who bring 77% of revenue, and who is slipping away
The problem
The business treats every customer the same, so it spends on people who would buy anyway and loses good customers without noticing.
The solution
An analysis that scores every customer on recency, frequency and spend, groups them into champions, loyal, new, at risk and lost, tracks how each starting month's customers return, and shows who to contact first in Power BI.
How it works
- Clean: Invoices cleaned: returns, cancelled orders and missing customers handled
- Score: Each customer scored on how recently, how often and how much they buy
- Group: Customers grouped into champions, loyal, new, at risk and lost
- Cohorts: How many customers from each starting month come back
- Report: A Power BI page per group, with who to call first
A closer look



The code
still_buying = customers.r_score >= RULES["still_buying_min_recency_score"]
good = customers.f_score + customers.m_score >= RULES["good_customer_min_frequency_plus_spend"]
customers["segment"] = np.select(
[still_buying & good, still_buying & (customers.orders == 1), still_buying, good],
["Champions", "New", "Loyal", "At risk"],
default="Lost",
)The impact
- The customers who bring most of the revenue, named: 1,772 champions bring 77% of it.
- 631 good customers who stopped buying, listed biggest spender first.
- Return rates by starting month: 20.8% of new customers buy again the next month.
The result
36,573 invoices: 30% of customers bring 77% of revenue, and 631 good customers are at risk.