← all work

Data · 01 / 04 · dbt · Airflow · Power BI

E-Commerce Analytics Warehouse

100,000 real orders replayed as a live source into a dbt star schema that is tested and reconciled to the cent on every run.

99,441orders, 597,649 source changes
85 / 85dbt tests passed on every load
Identicalincremental vs full rebuild hashes
R$ 0.00revenue gap, source vs warehouse

Why I built this

In the real world

Every e-commerce company runs on dashboards fed by a warehouse loaded from the live database. Late updates, crashed loads and customers who change address make those numbers quietly disagree with reality, and business decisions get made on them anyway.

What I wanted to find out

Can a dashboard number be trusted to the cent, even when orders arrive late, loads crash halfway and customers move house? I wanted to build the whole path from a live database to a chart, and stop any run whose numbers don't add up.

What I built

The Olist dataset is a static snapshot, so I built a simulator that replays its own timeline into MySQL: orders arrive, get approved, ship and get delivered, and reviews come in later.

A Python loader moves changes into PostgreSQL incrementally, dbt models them into a star schema, Airflow runs it every ten minutes, and every run is tested and reconciled against the source before anyone reads a number.

On top of the marts sit a 4-page Power BI report (37 DAX measures, seller drill-through, row-level security by seller state) and an Excel seller workbook built with Power Query, PivotTables and XLOOKUP. Both match the warehouse revenue to the cent.

How it works

Simulatorreplays business time
MySQLoperational source
Python ELwatermark + lookback
PostgreSQLraw → dbt star schema
Power BIreport, Excel, Metabase

Airflow runs extract → snapshot → dbt run → dbt test → reconcile. A failing test stops the run before anyone reads a bad number.

How it stays correct

No change is missed

An updated_at watermark with a lookback window that re-reads recent history for late commits.

Reruns are idempotent

MERGE applies only newer versions. A rerun with no new data applies 0 rows.

A crash leaves nothing half-loaded

Data and watermark commit in one transaction. Tested with SIGKILL mid-load.

Orders join the address at purchase time

SCD Type 2 customer snapshots and a point-in-time join.

Measured

Run
The full dataset replayed in 27 ticks of 30 business days
Every tick
85/85 dbt tests and 32/32 reconciliation checks passed
Revenue
R$ 15,843,553.24 in the source and the marts, to the cent
Finding
Orders 8+ days late average a 1.7 review score, against 4.3 when on time
BI
Power BI report and Excel workbook agree on R$ 15,735,527.03 of non-cancelled revenue
Power BI overview page
Power BI overview: revenue against the prior year and the top categories.
Power BI seller drill-through page
Right-click any seller to drill through to its own page.
Power BI sales trends page
Sales trends: month-on-month growth, running total, 3-month moving average, YoY and YTD.
Power BI delivery and reviews page
Delivery and reviews: late orders score 2.27 against 4.29 on time, plus the cohort triangle.
Metabase revenue dashboard
Revenue dashboard, built through Metabase's API.
Delivery performance dashboard
Late deliveries vs review scores.