Analytics & BI · Customer segmentation

RFM segmentation that tells marketing exactly who to act on

An automotive service network spent the same on every customer and only noticed churn once it had already happened. I built a dynamic RFM engine that scores every customer on Recency, Frequency and Monetary value, assigns a loyalty tier and an activity status — so marketing acts on each person, not on averages.

RoleSole Data Engineer
IndustryAutomotive service
ScopePer customer · per year
StackPySpark · PostgreSQL
6loyalty tiers, scored automatically
7activity statuses, refreshed every run
‹X›%lower ad spend (add real number)

The problem

Marketing paid the same for everyone

Campaigns were one-size-fits-all: the same offer and the same budget reached a brand-new customer and a ten-year loyal one. There was no way to see who's valuable, who's slipping, and who's already gone.

What RFM means

Three simple questions about every customer

R

Recency

How recently did they last come in? Days since their last service visit — the fresher, the more engaged.

F

Frequency

How often do they come back? Total service visits over their whole lifetime with the network.

M

Monetary

How much do they spend? Total spend on works and parts, converted to a stable USD base.

What I built

A pipeline that scores and labels every customer

From the network's service history I compute Recency, Frequency and Monetary value for every customer, for every year of their lifetime. Each customer is ranked against their true peers, the ranks are normalized into one comparable 0–1 loyalty score, and from that score they get a loyalty tier and an activity status.

Because it runs per customer, per year, the output isn't a one-off snapshot — it's a trajectory. You see exactly when someone starts slipping.

Source — service history (visits · parts · works)
1–3
R / F / M metricsPer customer, per year — plus USD conversion & derived metrics
4
Rank & normalizeRanked vs peers, min-max normalized to one 0–1 score
5
Loyalty tierPlatinum · Gold · Silver · Bronze · Prospect · Dormant
6
Activity statusActive · Declining · At risk · Churned …
Per-customer Power BIEvery customer, tiered and tracked

Why my approach works

Dynamic, normalized scoring — not a static label

Most RFM is a one-time snapshot with hand-picked thresholds. Mine ranks each customer against their real peers and normalizes those ranks into one fair, comparable score — recomputed every year. That's what makes it sensitive enough to catch a loyal customer the moment they start cooling off.

The result

Every customer, tiered and tracked

Marketing opens one dashboard and sees the whole base by loyalty tier and activity status — and can drill to any single customer. (Distribution shown is illustrative.)

Customer segmentation · RFM overview refreshed yearly
Loyalty tiers (by RFM score)
Platinum
5% · 0.95–1.0
Gold
14% · 0.75–0.95
Silver
22% · 0.55–0.75
Bronze
26% · 0.30–0.55
Prospect
19% · 0.15–0.30
Dormant
14% · 0.00–0.15
Activity status
Active New Declining At risk Reactivated Won back Churned
Client #146853 · Private · Toyota · since 2017
A Platinum customer who's quietly cooling off
Platinum Declining
0.88R
1.00F
1.00M

Down to one customer

One customer's full RFM journey — year by year

Drill into any single customer and see their entire trajectory — every year their tier, their status, and the exact moment their rating starts to slip. That early warning is what marketing acts on, months before a churn report would notice.

Client #146853 · Private · Toyota10 years of history
YearVisitsTotal $Loyalty tierActivityRatingRating Δ
20174$688SilverNew0.650.0%
20189$1,969GoldActive0.900.0%
20198$3,398GoldActive0.950.0%
202011$4,837GoldActive0.950.0%
20216$5,878PlatinumActive1.000.0%
20224$7,616PlatinumDeclining0.95−3.5%
20238$8,925PlatinumActive0.95−1.3%
20246$10,696PlatinumActive0.95−1.4%
20255$12,759PlatinumActive1.00−0.3%
20261$13,333PlatinumDeclining0.95−1.8%

This customer climbed from Silver to Platinum in four years, dipped in 2022 (−3.5%), recovered, and is cooling again now. Every turn was flagged the year it happened — months before a churn report would notice.

Loyalty rating — catch the decline, don't lose them
Loyalty rating (0–1) Declining — react now If ignored → churn
R / F / M components over time
Recency Frequency Monetary
Lifetime service visits
Cumulative visits — 62 over the lifetime
Lifetime spend (USD)
Cumulative spend — $13,333 lifetime

The amber points are the moment to act: the customer is Declining but still recoverable. Ignore them and the same person slides to Churned — when winning them back costs far more. The whole value is reacting in the amber zone, not the red one.

The point

Each group gets its own playbook — so ad spend stops leaking

Once every customer has a tier and a status, marketing knows the exact play for each group. Promos go only where they move the needle — not blanket-sprayed across the whole base.

GroupWhat it meansMarketing playAd spend
Platinum · ActiveYour best, fully engaged customersVIP perks & loyalty care≈ none needed
Gold / Silver · DecliningValuable customers starting to slipTargeted win-back offer — the high-ROI movefocus here
Bronze · NewRecent customers worth growingOnboarding nudge, next-service reminderlow
Dormant / ChurnedAlready gone or never engagedOne low-cost reactivation — then stopminimal

Built to be trusted

Scores the business can stand behind

  Fair, stable, validated

  • USD-normalized spend — monetary value is converted to a stable base, so currency swings don't reshuffle the rankings.
  • Recency capped — extreme gaps are clamped (5 years) so outliers can't distort the normalized score.
  • Per-customer dedup — every visit is tied to one customer identity before scoring.
  • Telegram alerts & Apache Airflow — orchestrated, monitored, refreshed reliably.

The outcome

From blanket spend to precise, timely action

Before

  • Same offer & budget for everyone
  • Churn noticed only after it happened
  • No per-customer value or loyalty view
  • Ad budget sprayed across the whole base

After

  • Every customer scored, tiered & tracked
  • Declines flagged the moment they start
  • A clear playbook per group
  • Promos only where they pay off — less wasted spend

Quantified business results (ad-spend reduction, retention lift) — add real numbers.

Stack & role

How it's built

Sole data engineer — metric design, scoring logic, data-quality and deployment.

Apache SparkPySparkSpark SQL window functionsApache AirflowPostgreSQLPower BITelegram alerts

Spending the same on every customer?

I'll score your whole base, flag who's slipping, and hand marketing a playbook per group — so the budget goes where it works.

Book a strategy call →