RFM Segmentation: A Practical Starting Point for Customer Intelligence
Before reaching for complex models, Recency, Frequency and Monetary analysis gives CRM teams an explainable, actionable view of customer value.
Draft — this article is a work in progress and may change before publication.
Customer segmentation is one of those topics where it's tempting to jump straight to clustering algorithms. In practice, one of the most useful starting points is also one of the simplest: RFM — Recency, Frequency and Monetary value.
The three questions
- Recency — how recently did the customer buy?
- Frequency — how often do they buy?
- Monetary — how much do they spend?
Each customer gets a score on each dimension, usually by ranking them into bands. Combining the scores produces segments that marketing teams instantly understand: loyal high-value customers, promising new customers, customers who are drifting away, and those who have already lapsed.
Why it works
RFM is explainable. A CRM manager can look at a segment and immediately see why a customer belongs there. That makes it much easier to agree on actions — a win-back offer, a loyalty reward, an onboarding journey — than with a black-box model.
Building it at scale
With PySpark and SQL, RFM features can be calculated across the full transaction history and refreshed on a schedule. Publishing the segments to Power BI lets teams explore them, size campaigns and track how customers move between segments over time.
pythonfrom pyspark.sql import functions as F
rfm = (
transactions
.groupBy("customer_id")
.agg(
F.datediff(F.current_date(), F.max("order_date")).alias("recency_days"),
F.countDistinct("order_id").alias("frequency"),
F.sum("net_amount").alias("monetary"),
)
)Where to go next
Once RFM is in place, it becomes a foundation for more advanced work: churn prediction, lifetime value modelling, recommendation engines, and — increasingly — using language models to describe segments and suggest actions in plain language.
- #RFM
- #Segmentation
- #CRM
More insights
From Procurement to Pipelines: Why Business Context Makes Better Data Engineers
Before I wrote a single Spark job, I was negotiating with vendors and watching margins. That background turned out to be my most useful technical skill.
Lakehouse Thinking with Microsoft Fabric: Notes on Designing for Ingestion
Modern data platforms succeed or fail at the ingestion layer. Some notes on combining managed connectors, ADLS Gen2 and OneLake into a lakehouse.
Agentic AI in eCommerce: From Dashboards to Decisions
Most eCommerce teams don't lack data or dashboards. They lack time to interpret them. That's where agentic AI gets interesting.