Report pages: Executive Overview · Category & Product Deep Dive · Customer & Payment Insights
Two fact tables at different grains — fact_order_items, one row per order line item, and fact_payments, one row per payment installment record — with dim_date, dim_customer, dim_seller, dim_product and dim_order as dimensions.
Both facts share order_id, but the field is unique in neither: an order has multiple line items and multiple payment records. Relating them directly produces an uncontrolled many-to-many relationship that silently inflates revenue and payment totals depending on query context. dim_order sits between them as a proper dimension, so both facts relate to it many-to-one — a clean, predictable star pattern.
Real datasets are messy. Documenting these decisions matters more than the charts — it shows how the problems were reasoned about, not just what got built.
customer_id is order-specific — the same person receives a new ID for every order. Used customer_unique_id as the true customer key for all customer-level metrics, including repeat rate and unique customer counts.order_items to payments relationship was many-to-many. Introduced dim_order as a bridge dimension so both facts relate many-to-one.order_items, having been cancelled or become unavailable before fulfilment. Confirmed as expected: the fact grain is order line item, so these are naturally excluded.canceled still had line items, having been cancelled after fulfilment began. Built a primary Total Revenue measure excluding cancelled and unavailable statuses, alongside a separate Total Revenue (Gross) measure for demand analysis.time, silently dropping the date portion. Diagnosed via INFORMATION_SCHEMA.COLUMNS and fixed by re-importing with an explicit yyyy-MM-dd HH:mm:ss format mapping.Total Revenue excludes cancelled and unavailable orders to reflect realised performance, with Total Revenue (Gross) available for demand analysis. Ratio measures such as Average Order Value use the same filtered population in numerator and denominator, so the two never disagree.