Retail model assembly
Start with a trustworthy model
A good retail report is built from a defined question: how much revenue and gross profit did the accepted sales generate, and how do those results vary by product and region? Do not start with charts. Declare one fact row per order line, not one row per order. Order O01 has two legitimate lines. Keep raw files immutable, record rejected records, then assemble four unique-key dimensions around FactSales. Use the synthetic retail-v1 fixture in labs/fixtures/ and its dimensional-v1 extension. All values represent USD and order dates January 5–7, 2026; no tax, returns or discounts. Tier A is offline with paper or a local worksheet; Tier B is an optional disposable Power BI Desktop Import report. Native DAX, M, refresh and rendering NOT RUN. No account, publish or tenant operations. See labs/retail-capstone/README.md for exact inputs and deliverables.
Example 1: audit before loading
Read sales-dirty.csv in source order, assigning a row number that excludes the header. The first five rows are the clean input. Row 6 repeats L05; the approved fixture rule retains the first exact copy. Row 7 has unknown P99 and is outside the report period; row 8 has an invalid date; row 9 has missing quantity and is outside the period. Record one primary rejection reason per row using that priority and retain all additional defects. Five accepted rows total 200 USD. Four rejected rows have known arithmetic of 60 + 10 + 12 = 82 USD and one unknown amount; 282 is only the known raw subtotal, not report revenue. Reject the duplicate-key product file as a lookup candidate: P01 maps to two labels. For this exercise the separately supplied products.csv is the authoritative corrected dimension. Do not arbitrarily choose a label or remove all records with repeated OrderID.
Example 2: build the model
Use the clean five-row fact-sales.csv as a verified starter, not as evidence that Power Query has run. In Desktop import it and products.csv, dim-date.csv, dim-customer.csv and dim-region.csv. Rename to FactSales, DimProduct, DimDate, DimCustomer, DimRegion. Assign types from the lab dictionary, explicitly check ISO dates and text identifiers, then Close & Apply. In Model view inspect or create four active one-to-many relationships from each dimension key to FactSales: ProductKey, Date to OrderDate, CustomerKey and Region respectively. Set single direction from dimension to fact. Do not link dimensions to each other. Check all four unique keys and zero unmatched fact keys. A product filter on Desk Lamp must select L02 and L05 only; both sum to 90 USD. Reconstruct RevenueUSD and CostUSD on paper as quantity times unit price or cost, and compare with the supplied derived columns. Use the supplied order-customer mapping to audit customer assignments; do not load it as another active dimension.
Why this matters
A duplicate lookup key can expand joined rows and inflate revenue. An orphan key may appear under a blank member in a regular Import relationship; hiding it in a chart does not fix the source. The audit and model are separate deliverables. If any accepted row fails a rule or any key is ambiguous, stop and reconcile rather than changing cardinality to make the visual display.
Practice
Complete task 1 in the capstone worksheet: submit the rejection log, typed table list, relationship diagram and independently reconstructed line values. Use the raw and clean inputs as separate artifacts.
Official reading
profile · clean · star · relationships · csv. Official documentation search extracts checked; exact build and native execution remain unverified.