Contact
← All projects

H&M Customer Retention Analysis

Which customers are quietly drifting away, how much revenue is at risk, and which of them are worth saving first.

Completed2026DuckDB SQL, Python, scikit-learn, Tableau
Cover for the H&M customer retention analysis, showing the Tableau dashboard and the headline result
Project cover.
  • 49.4%of lost revenue caught by risk times spend, vs 11.0% plain
  • 0.77model AUC on an unseen later period
  • 31.8Mpurchases analysed, from 1.37M customers

The question

Which H&M customers are quietly drifting away, how much revenue is at risk, and which ones are actually worth saving first? The context is a fashion retailer under pressure from faster, cheaper rivals. The data carries no competitor information, so I never claim to know why customers leave.

What I did

  • Worked a 10% customer sample of the public H&M dataset, 137,571 customers and 3.2 million purchases, with DuckDB SQL on a laptop, and checked the sample against the full 31.8 million rows.
  • Built a retention funnel and sorted every customer into on track, slipping, drifting or gone quiet by comparing their silence against their own usual gap between visits.
  • Trained a logistic regression churn model, then read its predictions against spend rather than accuracy alone.
  • Shipped a Tableau Public dashboard and a script where a free local AI model writes a monthly summary, with a built-in number checker added after an early version mixed up customers and revenue.

What I found

  • About a fifth of yearly revenue sits with customers who have gone quiet or are drifting, and roughly 12.1% is likely gone for good.
  • The model scored 0.77 AUC on a later period it never saw, but its riskiest customers were small spenders, so chasing accuracy alone would have protected almost none of the money.
  • Ranking the same top 20% of customers by risk times spend catches 49.4% of the revenue that later goes quiet, against 11.0% for a plain churn model, about 4.5 times the money from the same sized list.

A note on the data and honesty

Built on the public Kaggle H&M dataset, which ends in September 2020, so this is a 2018 to 2020 picture and cannot say how H&M is doing today. Prices are scrambled, so revenue is treated as an index, never pounds. Everything found shows links, not proof, so the recommendation is a randomised test before any spend. Independent project, free and open source, not affiliated with or endorsed by H&M.

  • Churn modelling
  • SQL
  • Python
  • scikit-learn
  • Tableau
  • Customer analytics
The H&M customer retention Tableau dashboard, with funnel, status, segments, methods and trend panels
The Tableau Public dashboard built for this project.