back to all case studiescase study // business intelligence
Business Intelligence•2024

E-Commerce Cohort & Revenue Analytics

Customer Lifetime Value (LTV), RFM segmentation & basket affinity analysis across 500k+ transactions

roleData & BI Analyst
duration4 Months
year2024
primary stackPostgreSQL (Window Functions, CTEs)
E-Commerce Cohort & Revenue Analytics
[01]

the problem

An omnichannel retailer had rapid customer acquisition numbers but struggled with declining repeat purchase rates. Executive leadership had conflicting reports regarding customer acquisition cost (CAC) payback periods and could not determine which product bundles produced long-term brand loyalty.

[02]

approach & architecture

Wrote complex PostgreSQL queries utilizing Common Table Expressions (CTEs) and window functions (`DENSE_RANK`, `LAG`, `NTILE`) to calculate monthly retention cohorts across 500,000+ orders. Applied statistical clustering and RFM segmentation in Python to categorize users into 11 distinct personas. Built an interactive Tableau dashboard suite displaying lifetime value curves and cross-sell affinities.

system highlights

Constructed relational data marts in PostgreSQL with optimized indexes on customer IDs, order dates, and SKU categories for sub-second query performance.
Formulated monthly cohort retention matrices calculating retention decay from Month 0 to Month 12.
Executed RFM (Recency, Frequency, Monetary) quintile scoring to isolate 'Champions', 'Potential Loyalists', 'At Risk', and 'Hibernating' buyer personas.
Identified cross-sell opportunities using association rule mining (Apriori algorithm) to discover high-margin product bundle pairs.
[03]

key features

01

Dynamic Cohort Retention Heatmap

Visualizes month-over-month customer retention decay by acquisition channel and seasonal campaign.

02

RFM Persona Matrix

Segmented customer database enabling targeted email marketing campaigns customized for high-value VIPs versus re-engagement candidates.

03

Customer Lifetime Value (LTV) Trajectory

Projects cumulative revenue per cohort to calculate true payback windows and customer acquisition spend efficiency.

04

Cross-Selling Basket Affinities

Interactive scatter plots illustrating item co-purchase frequencies and lift ratios for merchandising teams.

[04]

technologies

PostgreSQL (Window Functions, CTEs)Tableau Desktop & ServerPython (Pandas, Plotly)RFM Customer SegmentationMarket Basket AnalysisAdvanced Excel
[05]

outcomes & metrics

Delivered deep, actionable visibility into post-acquisition customer behavior, directly influencing inventory strategy and increasing high-margin repeat order frequency.

✓ outcome

24% increase in repeat purchase rate following RFM campaign segmentation

✓ outcome

32% higher average order value (AOV) on algorithmic bundle recommendations

✓ outcome

Automated 15 hours/week of manual Excel reporting into an instant Tableau dashboard