Customer and Order Dimensional Model Case Study
A practical enterprise data modeling pattern or illustrative case study.
This illustrative scenario models order activity for sales and fulfillment analysis. Questions include order volume, line revenue, fulfillment delay and customer history. The example is fictional; definitions and policies must be confirmed for a real business.
Scenario and requirements
This illustrative scenario models order activity for sales and fulfillment analysis. Questions include order volume, line revenue, fulfillment delay and customer history. The example is fictional; definitions and policies must be confirmed for a real business.
Declare the grain
Use one fact row per order line as a starting point, with order, product, customer, order date and fulfillment date keys. If multiple shipments per line occur, represent shipment events separately rather than repeating line revenue for each shipment.
Choose measures and dimensions
Measures may include ordered quantity and extended amount at line grain. Dimensions describe customer, product, channel, date and promotion where their meanings are agreed. Store currency and discount treatment explicitly. Customer attributes may require a history strategy for point-in-time analysis.
Validate
Test canceled orders, returns, partial shipments, customer merges, late corrections and multi-currency cases. Reconcile line counts and amounts to the source under matching filters. Kimball's guidance emphasizes declaring fact-table grain; see Kimball fact table structure.
Apply the pattern
Confirm business meaning, workload, ownership and constraints with the people responsible for the system and its consumers. Use representative test cases and record assumptions, exceptions and change responsibilities.
Case questions and grain
A retailer wants to analyze order value, product mix and customer activity over time. Begin by separating the order header from its lines. A fact at order-line grain can describe one product on one order; a separate order-level fact can describe payment or shipping measures. Do not repeat order-level amounts across every line and then sum them.
Choose facts and dimensions
The order-line fact can connect to date, customer, product, promotion and channel dimensions. Define each dimension's identity and history behavior. A customer dimension may have current attributes and historical versions; a product category change can either restate history or preserve the category at sale time, depending on the reporting question.
Measures need explicit units and aggregation rules. Quantity and extended amount are generally additive at compatible grains; unit price and return rate are not safely summed. Define how discounts, tax, shipping, cancellation and returns affect net sales.
Handle corrections and returns
Returns may arrive after the original sale and can be partial. Decide whether a return is a separate fact, a reversal, or both for different consumer needs. Preserve the link to the original line and record the return event date separately from the sale date. Define how late corrections restate prior reports.
Validate the model
Use sample orders with multiple lines, discounts, partial shipments, cancellation and partial returns. Reconcile order-level totals to line-level calculations and check for join multiplication. Ask analysts to answer questions using both order and line facts, then compare expected results.
- Are order and order-line grains distinct?
- Are measure aggregation rules documented?
- Are customer and product histories appropriate?
- Are returns and reversals linked and timed clearly?
- Do joins preserve expected totals?
Worked example: cancellation and return
Keep the original order line, cancellation event, shipment, return authorization, received goods, and refund or credit distinct. A cancellation before fulfillment is different from a post-delivery return. Model quantities and amounts at line grain, and define whether canceled units remain in order intake measures. Preserve the event date used for each metric.
Customer and product dimensions may change after the sale. Decide whether analysis uses values at transaction time or corrected current classifications. Avoid joining multiple fact tables directly if their grains differ. Aggregate each to a compatible level before combining or use a conformed dimension with explicit relationships.
Reconcile sales, returns, and inventory
Test partial shipment, substitution, partial refund, return without receipt, and duplicate order messages. Reconcile net sales to financial controls and inventory movement to stock records. Publish the metric rules with examples so analysts do not treat all negative quantities or statuses identically.
Consumer tests for the customer and order model
Validate order count, net sales, product mix, repeat purchase, and return measures at customer, product, channel, and date grains. Ensure customer identity resolution does not multiply order lines. Confirm dimension assignments and treatment of unknown customers.
Test a corrected order date, changed product category, and merged customer. Record whether historical reports restate or retain the earlier context. Have business and finance owners sign off on measures that drive decisions.
Release acceptance for customer and order models
Verify declared grain, conformed dimensions, historical product and customer context, return treatment, and net sales calculation. Reconcile source totals and test a customer merge. Publish freshness and known limitations.
Assign owners for dimensions, facts, metrics, and consumer support.