First multi-column SUM aggregation. Practice computing four parallel SUM columns from one table scan, joining a fact (settlements) through another fact (orders) to a dim (marketplaces), and rounding monetary totals for board-pack output.
Board-prep all-time fee breakdown by marketplace. From fact_settlements, sum the four fee categories (marketplace_fee, ad_fee, fulfillment_fee, refund_amount) per marketplace. Five columns: marketplace_name, marketplace_fee_total, ad_fee_total, fulfillment_fee_total, refund_total — all rounded to 2 decimals. Sort marketplace_fee_total descending, marketplace_name ascending. The board sees this every quarter — it's the GMV-vs-payout reconciliation in summary form (M16 builds the full reconciliation with payout).
| Column | Type | Key |
|---|---|---|
| settlement_id | INT | PK |
| order_id | INT | FK → fact_orders |
| settle_ts | TEXT | |
| gross_amount | REAL | |
| marketplace_fee | REAL | |
| ad_fee | REAL | |
| fulfillment_fee | REAL | |
| refund_amount | REAL | |
| net_payout | REAL |
| Column | Type | Key |
|---|---|---|
| order_id | INT | PK |
| listing_id | INT | FK → dim_listings |
| marketplace_id | INT | FK → dim_marketplaces |
| order_ts | TEXT | |
| units | INT | |
| gross_amount | REAL | |
| refunded | INT |
| Column | Type | Key |
|---|---|---|
| marketplace_id | INT | PK |
| marketplace_name | TEXT | |
| marketplace_fee_pct | REAL | |
| fba_supported | INT |
Each hint you reveal reduces the XP you can earn. Try the query first.
Join fact_settlements → fact_orders (on order_id) → dim_marketplaces (on marketplace_id).
Four parallel ROUND(SUM(...), 2) for each fee category.
GROUP BY marketplace_name so each platform gets its own row with the fee components.
Sort marketplace_fee_total DESC — the highest-fee platform leads the discussion.