gold.fact_sales
The sales fact table contains transactional sales data at the order line item level. Each row represents a single product sold to a customer as part of an order.View Definition
Fact Table Grain
The grain of this fact table is one row per order line item:- Each unique combination of
order_numberandproduct_keyrepresents a distinct line item - Multiple products in the same order will create multiple rows
- The same customer can appear in multiple rows across different orders
Grain Definition: One row = One product sold in one order to one customer
Dimension Relationships
This fact table connects to two dimensions:Customer Dimension
Joined via
customer_id to gold.dim_customer to get the surrogate customer_keyProduct Dimension
Joined via
product_number to gold.dim_product to get the surrogate product_keyFields
Degenerate Dimension
Sales order number from the CRM system. Acts as a degenerate dimension - an identifier stored in the fact table rather than in a separate dimension.
Foreign Keys
Foreign key to
gold.dim_product. Surrogate key derived by joining on product_number. May be null if product is no longer in the active catalog.Foreign key to
gold.dim_customer. Surrogate key derived by joining on customer_id.Date Attributes
Date when the sales order was placed. Key dimension for time-series analysis and period comparisons.
Date when the order was shipped. Used to calculate fulfillment time and shipping metrics. Note: field name preserved from source system.
Measures
Total sales revenue for this line item. This is the primary additive measure for revenue calculations.
Number of units sold for this product in this order line. Additive measure for volume analysis.
Unit price for the product on this order. This is a semi-additive measure (averaging is more appropriate than summing).
Measure Types
Understanding measure additivity is crucial for accurate aggregations:Additive Measures
Additive Measures
sales_amount and quantity are fully additive - they can be summed across all dimensions (customer, product, time).
Semi-Additive Measures
Semi-Additive Measures
price should not be summed across multiple rows. Use averages or weighted calculations instead.