Analytics Engineering · Case Study

Olist Warehouse

Modeling 100,000 Brazilian e-commerce orders into a Snowflake star schema — and the three questions it answers.

SNOWFLAKE  ·  DBT  ·  STAR SCHEMA  ·  KAGGLE OLIST
Nathanael Johnson Analytics Engineer
The question

Olist — Brazil's largest department-store marketplace — released ~2 years of real transactions across 8 normalized tables. The raw tables can't answer a single strategic question on their own.

Where is the revenue actually coming from, are sellers staying, and is late delivery a logistics problem or a geography problem?

The data

Eight normalized tables, ~2 years, loaded into Snowflake

Source: Olist Brazilian E-Commerce — public on Kaggle, real and multi-table
99,441
customers
99,441
orders
112,650
order_items
103,886
order_payments
99,224
order_reviews
32,951
products
3,095
sellers
1,000,163
geolocation
The model

A single-fact Kimball star

fact_orders grain: order × line item 112,650 rows · 98,666 orders dim_date 1,827 · role-played 3× dim_customer 96,352 · SCD Type 2 dim_seller 3,095 dim_product 32,951 · +category_group dim_geography 19,015 · conformed dim_payment 28

The grain is line item, not order — so revenue stays additive and the per-seller story survives.

dim_customer is SCD Type 2, keyed on customer_unique_id because people relocate between orders. dim_geography is conformed across customer and seller.

Finding 01

Revenue is wildly concentrated

gross revenue by region · R$15.8M total across 98,666 orders
Sudeste R$10,226,484 Sul R$2,295,786 Nordeste R$1,874,175 Centro-Oeste R$993,279 Norte R$409,309 65% 14.5% 11.9% 6.3% 2.6%

65% comes from one region — the São Paulo–Rio–Minas axis. The Norte, geographically the largest, is 2.6%. Even regional effort allocation spends four-fifths of effort on one-fifth of opportunity.

Finding 02

Seller retention is moderate, not a cliff

% of each cohort still selling · rows = cohort month · columns = months since first sale
M1
M2
M3
M4
M6
M8
2017-Jan
71
70
60
64
50
50
2017-Apr
54
47
50
49
38
38
2017-Jul
68
62
61
68
57
52
2017-Oct
66
55
56
48
48
37
2018-Jan
57
50
57
45
40
2018-Apr
60
52
53
48

I expected a churn cliff; the data pushed back. ~50% of every cohort is still active at month 6. The risk isn't collapse — it's the steady ~40% who drift off in the first quarter, which acquisition has to keep refilling.

Finding 03

Late delivery is geographic, not categorical

% of orders delivered late, by category group
Sudeste
Rest of Brazil
0 4% 8% 12% 7.411.1 7.69.8 7.29.5 5.39.1 7.78.8 7.18.1 health & beauty electronics home & garden fashion industrial sports

Inside Sudeste it's ~7% regardless of category; outside it climbs 1.3–1.7×, widest for fashion. The lever is the freight network by region, not supplier SLAs by product — and the same dim_geography from Finding 01 surfaces it in one join.

So what

One conformed dimension answered two of the three questions.

Revenue

65% is one region. Effort allocation should say so out loud, not spread evenly.

Retention

No cliff — I was wrong about that. The job is refilling first-quarter drift, not stopping collapse.

Delivery

Fix the freight network outside Sudeste — it's geography, not product SLAs.

How it was built

A clustered, fully-tested Kimball build

Kaggle CSVs
Snowflake RAW
PUT + COPY
dbt staging views
dbt marts
15
dbt models
31 / 31
tests passing

unique · not_null · relationships · accepted_values. fact_orders is clustered on purchase_date_key — every dashboard filters by date first. The retention cohorts use LAG() windows over a cohort × period cross-join — no triangular subquery.

Eight flat tables in. Three decisions out.

Repo github.com/nathanaelhub/olist-warehouse
Work nathanaeljohnson.net/work/olist-warehouse
Nathanael Johnson Analytics Engineer
01 / 01