What the numbers say
All values cover the full timespan of the dataset, 2016 to 2018.
3.12% of customers ever place a second order
Across 99K+ orders from 96K customers, Olist is close to a one-purchase business. After a customer's first month, the chance they return in any later month stays below 0.5%. Revenue is concentrated too: the top 10% of customers bring in 38.5% of it.
The public Brazilian E-Commerce dataset from Olist, on Kaggle: 99,441 orders from 96,096 unique customers between 2016 and 2018, spread across nine tables covering orders, items, payments, reviews, products, sellers and geography.
I wrote the analysis in PostgreSQL 16 as five query files, from schema through KPIs, customers, products and retention. I later built a Power BI dashboard on the same data to go with it.
All values cover the full timespan of the dataset, 2016 to 2018.
| Metric | Value |
|---|---|
| Total revenue | $16.0M |
| Orders / unique customers | 99,441 / 96,096 |
| Average order value (total payments per order) | $160.99 |
| Average customer lifetime value | $166.59 |
| Revenue from the top 10% of customers | 38.5% (top 20%: 53.8%) |
| Repeat-purchase rate | 3.12% of customers order more than once |
| Share of each month's customers who are new | ≈96% |
| Average time to a second purchase | ≈88 days, for customers who make one |
| Orders delivered after the estimated date | 7.87% |
| Average review score | 4.09 / 5 |
Each query file answers a set of questions and is followed by a short comment recording what it returned and what it means.
| File | Questions answered |
|---|---|
| 01_schema.sql | Creates the nine Olist tables with primary keys |
| 02_kpis.sql | Revenue and month-over-month revenue, unique customers, new vs returning customers by month, order count, average order value, repeat-purchase rate, monthly cohort retention, review score, delivery delay |
| 03_customer.sql | Customer lifetime value, revenue share by customer decile (running totals with window functions), distribution of orders per customer |
| 04_product.sql | Revenue share by product and by category, average review by category |
| 05_retention.sql | Days from first to second purchase, repeat rate by first-purchase cohort |
Techniques: multi-step CTEs, window functions (LAG, ROW_NUMBER, running SUM and COUNT with OVER), cohort construction with DATE_TRUNC and AGE, and conditional aggregation with CASE.