• Portfolio project
  • Synthetic dataset
  • Customer Intelligence

Cohort retention analysis: when do customers stop coming back?

A portfolio cohort analysis of 15 months of e-commerce orders, with a reusable SQL pipeline and retention heatmaps showing when customers stop returning.

Project type
Portfolio project
Dataset
Synthetic dataset
Dataset provenance
A synthetic Shopify-format order dataset (October 2023 to December 2024) generated with the project's own Python script.
Client status
Demonstration analysis; does not represent a PA Data Analytics client.
RETENTION BY COHORTOct 232023-10 cohort, month 1: 39% retained2023-10 cohort, month 2: 22.9% retained2023-10 cohort, month 3: 18.5% retained2023-10 cohort, month 4: 17.1% retained2023-10 cohort, month 5: 15.1% retained2023-10 cohort, month 6: 10.2% retained2023-10 cohort, month 7: 14.6% retained2023-10 cohort, month 8: 10.7% retained2023-10 cohort, month 9: 12.2% retained2023-10 cohort, month 10: 10.2% retained2023-10 cohort, month 11: 7.3% retained2023-10 cohort, month 12: 8.3% retained2023-10 cohort, month 13: 7.8% retained2023-10 cohort, month 14: 5.4% retained2023-11 cohort, month 1: 40.5% retained2023-11 cohort, month 2: 20.3% retained2023-11 cohort, month 3: 21.2% retained2023-11 cohort, month 4: 16.2% retained2023-11 cohort, month 5: 12.6% retained2023-11 cohort, month 6: 12.2% retained2023-11 cohort, month 7: 11.3% retained2023-11 cohort, month 8: 9.9% retained2023-11 cohort, month 9: 10.4% retained2023-11 cohort, month 10: 10.4% retained2023-11 cohort, month 11: 6.3% retained2023-11 cohort, month 12: 9% retained2023-11 cohort, month 13: 8.6% retained2023-12 cohort, month 1: 43.1% retained2023-12 cohort, month 2: 23.9% retained2023-12 cohort, month 3: 22.3% retained2023-12 cohort, month 4: 12.2% retained2023-12 cohort, month 5: 16% retained2023-12 cohort, month 6: 9% retained2023-12 cohort, month 7: 13.8% retained2023-12 cohort, month 8: 9.6% retained2023-12 cohort, month 9: 9.6% retained2023-12 cohort, month 10: 7.4% retained2023-12 cohort, month 11: 9% retained2023-12 cohort, month 12: 9.6% retainedJan 242024-01 cohort, month 1: 35.2% retained2024-01 cohort, month 2: 20% retained2024-01 cohort, month 3: 20.5% retained2024-01 cohort, month 4: 15.2% retained2024-01 cohort, month 5: 14.8% retained2024-01 cohort, month 6: 9% retained2024-01 cohort, month 7: 9.5% retained2024-01 cohort, month 8: 9% retained2024-01 cohort, month 9: 12.4% retained2024-01 cohort, month 10: 10.5% retained2024-01 cohort, month 11: 10.5% retained2024-02 cohort, month 1: 39.1% retained2024-02 cohort, month 2: 25.5% retained2024-02 cohort, month 3: 21.1% retained2024-02 cohort, month 4: 17.4% retained2024-02 cohort, month 5: 15.5% retained2024-02 cohort, month 6: 9.9% retained2024-02 cohort, month 7: 12.4% retained2024-02 cohort, month 8: 8.1% retained2024-02 cohort, month 9: 6.2% retained2024-02 cohort, month 10: 7.5% retained2024-03 cohort, month 1: 33.9% retained2024-03 cohort, month 2: 22.4% retained2024-03 cohort, month 3: 18.8% retained2024-03 cohort, month 4: 10.4% retained2024-03 cohort, month 5: 9.4% retained2024-03 cohort, month 6: 13.5% retained2024-03 cohort, month 7: 10.9% retained2024-03 cohort, month 8: 8.3% retained2024-03 cohort, month 9: 10.4% retainedApr 242024-04 cohort, month 1: 34.1% retained2024-04 cohort, month 2: 22.5% retained2024-04 cohort, month 3: 17.6% retained2024-04 cohort, month 4: 13.7% retained2024-04 cohort, month 5: 15.4% retained2024-04 cohort, month 6: 9.9% retained2024-04 cohort, month 7: 12.1% retained2024-04 cohort, month 8: 10.4% retained2024-05 cohort, month 1: 36.8% retained2024-05 cohort, month 2: 20.3% retained2024-05 cohort, month 3: 13.4% retained2024-05 cohort, month 4: 11.7% retained2024-05 cohort, month 5: 13% retained2024-05 cohort, month 6: 10.4% retained2024-05 cohort, month 7: 6.5% retained2024-06 cohort, month 1: 37.8% retained2024-06 cohort, month 2: 27.9% retained2024-06 cohort, month 3: 16.9% retained2024-06 cohort, month 4: 12.9% retained2024-06 cohort, month 5: 9.5% retained2024-06 cohort, month 6: 16.9% retainedJul 242024-07 cohort, month 1: 38.8% retained2024-07 cohort, month 2: 27% retained2024-07 cohort, month 3: 19.4% retained2024-07 cohort, month 4: 15.8% retained2024-07 cohort, month 5: 13.8% retained2024-08 cohort, month 1: 39.5% retained2024-08 cohort, month 2: 20.6% retained2024-08 cohort, month 3: 14.9% retained2024-08 cohort, month 4: 15.8% retained2024-09 cohort, month 1: 38% retained2024-09 cohort, month 2: 25.9% retained2024-09 cohort, month 3: 20% retainedOct 242024-10 cohort, month 1: 38.2% retained2024-10 cohort, month 2: 21.3% retained2024-11 cohort, month 1: 36.9% retainedM1M3M6M9M125%45%+Portfolio project · Synthetic dataset · Avg M1 37.9%
Chart drawn from the project's own outputs · Synthetic dataset · portfolio project.
View the data behind this chart
CohortM1M2M3M4M5M6M7M8M9M10M11M12M13M14
2023-1039%22.9%18.5%17.1%15.1%10.2%14.6%10.7%12.2%10.2%7.3%8.3%7.8%5.4%
2023-1140.5%20.3%21.2%16.2%12.6%12.2%11.3%9.9%10.4%10.4%6.3%9%8.6%–
2023-1243.1%23.9%22.3%12.2%16%9%13.8%9.6%9.6%7.4%9%9.6%––
2024-0135.2%20%20.5%15.2%14.8%9%9.5%9%12.4%10.5%10.5%–––
2024-0239.1%25.5%21.1%17.4%15.5%9.9%12.4%8.1%6.2%7.5%––––
2024-0333.9%22.4%18.8%10.4%9.4%13.5%10.9%8.3%10.4%–––––
2024-0434.1%22.5%17.6%13.7%15.4%9.9%12.1%10.4%––––––
2024-0536.8%20.3%13.4%11.7%13%10.4%6.5%–––––––
2024-0637.8%27.9%16.9%12.9%9.5%16.9%––––––––
2024-0738.8%27%19.4%15.8%13.8%–––––––––
2024-0839.5%20.6%14.9%15.8%––––––––––
2024-0938%25.9%20%–––––––––––
2024-1038.2%21.3%––––––––––––
2024-1136.9%–––––––––––––
2024-12––––––––––––––

01Business question

Most online stores know that many customers never come back, but not when the drop-off happens, which acquisition months produce the most loyal customers, or how revenue builds up across customer groups.

02Dataset & context

Dataset: Synthetic / Demonstration Dataset. This portfolio analysis uses a synthetic order dataset generated in Shopify's order-export format: 6,404 orders from 2,810 customers between October 2023 and December 2024, with $401,672 in recorded revenue. It does not represent a PA Data Analytics client. Because it follows the Shopify export format, the same pipeline can be run on a real Shopify orders export.

03Approach

Group customers by the month of their first purchase, then track what share of each cohort returns in each later month and how much returning customers spend.

04Methodology

  • A SQL pipeline of views that assigns each customer to an acquisition cohort, calculates months since first purchase, counts active customers per cohort month and calculates retention rates.
  • Written in standard SQL (run in SQLite) so it can be adapted to warehouses such as BigQuery or PostgreSQL with minor dialect changes.
  • Retention heatmaps from month 0 to month 14, retention curves, and revenue per active customer by cohort month.

05Modelling & analysis

Dataset findings: average retention was 37.9% at month 1, 23.1% at month 2, 18.7% at month 3, 11.2% at month 6 and 9.0% at month 12. The largest loss happens between the first purchase and month 1, after which the curve flattens.

The October 2023 cohort, the longest-running in the dataset, shows the pattern clearly: 205 customers at acquisition, 80 in month 1, 21 in month 6 and 17 in month 12. Customers who kept buying tended to spend more per order over time.

06Results within the dataset

In this dataset, most customer loss happens in the first month after the first purchase, so that is where retention effort would have the greatest leverage. These are findings from synthetic data, not results achieved by a business.

07What this analysis demonstrates

How cohort analysis shows the timing of customer loss, which a single overall retention rate hides, and how a reusable SQL pipeline can be refreshed each month to track whether retention is improving.

08How a business could use this analysis

  • Focus retention effort on the first 30 days after a first purchase, where losses are usually largest.
  • Compare acquisition months and channels to see which bring the most loyal customers.
  • Refresh the cohort pipeline monthly to measure the effect of changes.

09Related service

This project demonstrates methods used in our customer intelligence services.

Related insight: A Beginner's Guide to RFM Segmentation in SQL

10Apply this to your data

If you are facing a similar question, we can look at what your data can support and what a useful answer would look like.

More case studies

REVENUE HEALTH & RETENTIONMRR by customer health scoreHealthy: 1,315 accounts, $288,465 MRRMedium Risk: 332 accounts, $92,598 MRRHigh Risk: 131 accounts, $21,489 MRRHealthy$288K · 1,315 acctsMedium + high risk$114,087 · 463 acctsAverage cohort retentionMonth 1: 91.6%91.6%M1Month 3: 81.3%81.3%M3Month 6: 72.0%72%M6Month 12: 60.2%60.2%M12Portfolio project · Synthetic dataset
  • Portfolio project
  • Synthetic dataset
  • Customer Intelligence

SaaS revenue health and churn risk analysis

A portfolio analysis of subscription revenue health (MRR movements, retention, acquisition channels, usage and support signals) combined into a rule-based customer health score.

Synthetic dataset: 86,402 rows · 6 tables · MRR at risk quantified

Read the SaaS churn case study

Let's turn your data into your next decision.

Tell us what you are trying to understand: marketing performance, customer retention, forecasting or reporting. We will reply with practical next steps.

Prefer email? [email protected]