Degenerate dimensions
Design an order-line fact that keeps the transaction identifier on the fact instead of inventing a low-value order dimension.
Concept
degenerate-dimensions
The primary modeling idea this problem reinforces.
Requirements
3
Business needs the model must satisfy.
A commerce team needs order-line revenue analysis by product and customer. The source system provides an order number shared by multiple line items, but that identifier has no descriptive attributes beyond the transaction itself.
Degenerate dimensions are a small pattern with big interview signal. They test whether a modeler understands fact grain well enough to keep transaction identifiers queryable without adding unnecessary joins.
- Create an order-line fact table with one row per purchased line item.
- Keep the order number or order id on the fact as a degenerate dimension.
- Join product and customer dimensions through explicit surrogate-key foreign keys.
Template
Order-line grain starter workspace
The model users start from in the full workspace.
Entities
2
Seeded tables visible in the public preview.
Dialect
postgresql
Generated SQL target for this starter model.
This preview is read-only. Open the workspace to edit and verify; saving needs a free account.
Open workspaceTry the question first.
The discussion has other people's approaches and solutions. Give it a real attempt before you read them.