Presentation is loading. Please wait.

Presentation is loading. Please wait.

Retail Sales is used to illustrate a first dimensional model

Similar presentations


Presentation on theme: "Retail Sales is used to illustrate a first dimensional model"— Presentation transcript:

1 Retail Sales is used to illustrate a first dimensional model
Chapter 2 Retail Sales is used to illustrate a first dimensional model Design process Case study: POS example Star schema Facts Dimensions Creating the schema in SQL Server January 2004 Ron McFadyen

2 The Dimensional Design Process
4 Step Dimensional Design Process Select the business process, examples: invoicing, orders, inventory, general ledger, … Declare the grain. Determine exactly what an individual fact table row represents. Examples: a line item on an order, a boarding pass to get on a flight, a student’s course registration, a monthly snapshot for a bank account. Choose the dimensions that apply to the facts. What describes each fact. Examples: customer dimension, student dimension, course dimension, day dimension. Identify the numeric facts that appear in the rows of the fact table. January 2004 Ron McFadyen

3 The business process: POS retail sales
Case Study Case Study The business process: POS retail sales Grain of the fact table: individual line items on a POS transaction The dimensions: date, product, store, promotion The facts: sales quantity, cost dollar amount, sales dollar amount, gross profit dollar amount (derivable) January 2004 Ron McFadyen

4 A typical drawing seen in practice, in articles, …
Case Study Schema Date Product Sales facts Store Promotion A typical drawing seen in practice, in articles, … January 2004 Ron McFadyen

5 Case Study Schema in Peter Chen Notation
1 1 Product Date n n Sales facts n n n Store Promotion 1 1 1 Sales Transaction Note: Sales transaction does not appear in text. Later in chapter it is discussed as a degenerate dimension January 2004 Ron McFadyen

6 Facts can be described as additive, non-additive, semi-additive.
Case Study Fact Table Sales facts Sales quantity Sales dollar amount Cost dollar amount Gross profit dollar amount Additive Facts can be described as additive, non-additive, semi-additive. Additive: can be meaningfully summed across all dimensions Semi-additive: …………………….. across some dimensions Non-additive: can’t be … The text discusses some non-additive facts that might be included in such a fact table: gross margin, unit price January 2004 Ron McFadyen

7 Case Study Fact Table The physical table: Sales facts Date key (FK)
Product key (FK) Store key (FK) Promotion key (FK) POS Transaction Number (degenerate dimension) Sales quantity Sales dollar amount Cost dollar amount Gross profit dollar amount PK January 2004 Ron McFadyen

8 Case Study Date Dimension
Very descriptive Easy to set criteria for queries Easy to get headings for reports One row for each day (this is the grain of the Date dimension) PK is a surrogate key Used in every star schema Hierarchies are present Not normalized attribute hierarchy Calendar week  … Fiscal week  … Date key (PK) Date Full date description Day of week Day number in epoch Week number in epoch Month number in epoch Day number in calendar month …. Last day in week indicator Holiday indicator Weekday indicator SQL date stamp Calendar week Calendar month Calendar year Fiscal week Fiscal month Fiscal year January 2004 Ron McFadyen

9 Case Study Product Dimension
Very descriptive Easy to set criteria for queries Easy to get headings for reports One row for each product for sale, or ever sold, by the company PK is a surrogate key. We do not use the operational PK here. Over time it may not be unique: the business may re-use keys, companies merge … Not normalized An attribute hierarchy Brand  category  department Product key (PK) Product description SKU number Brand description Category description Department description Package type description Package size Fat content Diet type Weight Weight units of measure January 2004 Ron McFadyen

10 Case Study Drilling Down/Up
Product Run a query to generate: Department, sales amount, sales quantity Now, add another attribute at a ‘lower’ level such as brand: Department, brand, sales amount, sales quantity What is meant by row-headers (in the text)? Product key (PK) Product description SKU number (natural key) Brand description Category description Department description Package type description Package size Fat content Diet type Weight Weight units of measure January 2004 Ron McFadyen

11 Case Study Store Dimension
Very descriptive Easy to set criteria for queries Easy to get headings for reports One row for each store PK is a surrogate key. Not normalized An attribute hierarchies city  county  state  zip district  region How does the text handles the “First open date” attribute? Store key (PK) Store name Store number (natural key) Store street address Store city Store county Store state Store zip code Total square footage First open date January 2004 Ron McFadyen

12 Case Study Promotion Dimension
Very descriptive Easy to set criteria for queries Easy to get headings for reports One row for each promotion PK is a surrogate key. Need a special row for “no promotion in effect” Why? Promotion key (PK) Promotion name Price reduction type Promotion media type Ad type January 2004 Ron McFadyen


Download ppt "Retail Sales is used to illustrate a first dimensional model"

Similar presentations


Ads by Google