Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review of Major Points Star schema Slowly changing dimensions Keys

Similar presentations


Presentation on theme: "Review of Major Points Star schema Slowly changing dimensions Keys"— Presentation transcript:

1 Review of Major Points Star schema Slowly changing dimensions Keys
Fact & Factless Additive, semi-additive, non-additive Degenerate dimensions Snowflaking Outriggers Extensibility Design process Slowly changing dimensions Type 1, 2, 3, hybrids Data warehouse architecture Bus Matrix Conformed dimensions Conformed facts Fact table types periodic snapshot accumulating snapshot transaction February 2004 Ron McFadyen

2 Fact table normalization Role playing Junk dimension
Ch 5 Ideas Fact table normalization Role playing Junk dimension Principles for handling: Units of measure, Currency Header fact allocations to line items Fact table types Lag calculations Additive 1s and 0s February 2004 Ron McFadyen

3 Fact table normalization
Consider …(FKs) Order qty Gross dollar amount Order deal discount dollar amount Net order dollar amount See figure 5.2 These facts will be densely populated in the fact table (if not 100%) February 2004 Ron McFadyen

4 Fact table normalization
Consider …(FKs) Fact type (FK) measure The concept of normalizing the fact table means that we reduce the fact table to one measure and add a new dimension for fact type (qty, gross, discount, net) No motivation for normalizing this schema (because the facts are densely populated February 2004 Ron McFadyen

5 There is one underlying or base table Each role is seen as a view
Role playing A schema exhibits role-playing if a single dimension appears more than once in the schema There is one underlying or base table Each role is seen as a view Date dimension found in every schema Consider a Northwind Dimensional Model with 3 date dimensions: February 2004 Ron McFadyen

6 Role playing Shipper Customer Employee Product Supplier Ordered Date
Order facts Quantity Discount amount Gross amount Net amount Employee Product Supplier Ordered Date Requested Date Shipped Date February 2004 Ron McFadyen

7 Junk dimension If, after assigning attributes to fact and dimension tables, there are a number of miscellaneous attributes left over, then if these attributes are lumped into one dimension the dimension is called a junk dimension e.g. (similar to figure 5.5 Key Payment type Payment type group Commission indicator 1 cash cash commissionable 2 cash cash Non-commissionable 3 Discover card credit commissionable 4 Discover card credit Non-commissionable 5 Mastercard credit commissionable February 2004 Ron McFadyen

8 A fact references the appropriate combination
Junk dimension A fact references the appropriate combination Key Payment type Payment type group Commission indicator 1 cash cash commissionable 2 cash cash Non-commissionable 3 Discover card credit commissionable 4 Discover card credit Non-commissionable 5 Mastercard credit commissionable February 2004 Ron McFadyen

9 A global company may handle several currencies
Recommendation: Store all facts in a local and standardized currency – this simplifies any analysis that end-users perform Order facts Quantity Discount amount local Discount amount Cdn Gross amount local Gross amount Cdn Net amount local Net amount Cdn Local currency Order facts Quantity Discount amount Gross amount Net amount February 2004 Ron McFadyen

10 Currencies To allow conversions (easily) to any currency, utilize a currency conversion fact table Order facts Quantity Discount amount local Discount amount Cdn Gross amount local Gross amount Cdn Net amount local Net amount Cdn Local currency key Currency conversion facts Date key Source currency key Destination currency key Source/Destination exch rate Destination/Source exch rate February 2004 Ron McFadyen

11 What SQL would report the total gross amount in US dollars?
Currencies What SQL would report the total gross amount in US dollars? Order facts Quantity Discount amount local Discount amount Cdn Gross amount local Gross amount Cdn Net amount local Net amount Cdn Local currency key Currency conversion facts Date key Source currency key Destination currency key Source/Destination exch rate Destination/Source exch rate February 2004 Ron McFadyen

12 Allocating facts to a lower granularity fact table
e.g. suppose the Order has a shipping charge. Where should that be stored? If we are creating an order line fact table, we could try to allocate the shipping charge to each line item. The allocation formula may not be easily determined. Without an allocation formula, analysts cannot explore the relationship between products and shipping charges Order facts Order shipping charges captured/known at the level of the order Quantity Discount amount Gross amount Net amount Shipping amount formula February 2004 Ron McFadyen

13 Assignment 2 Due Friday Feb 13, 2004
Use DTS to perform an initial load of a Star Schema for a Northwind Dimensional database Some details Create your own copy of Northwind to use as source data Use surrogate keys for each dimension PK of fact table is catenation of all FKs and DDs Sample stored procedure for populating the Date dimension Initial load of fact table may assume only one record in a dimension per natural key Use a view to facilitate loading the fact table with its FKs and facts February 2004 Ron McFadyen

14 Assignment 2 Order (DD) Shipper Customer Employee Product Supplier
Order facts Quantity Discount amount Gross amount Net amount Employee Product Supplier Ordered Date Requested Date Shipped Date February 2004 Ron McFadyen

15 Fact tables: Transaction, Periodic Snapshot, Accumulating Snapshot
Figure 5.8 Shipment Invoice Line Item Transaction fact table Figure 5.10 Order Fulfillment Accumulating fact table Figure 5.8 One row per invoice line item Figure 5.10 One row per item ordered – I.e. per order line item A row is updated by ETL as the line item progresses through manufacturing, shipping, invoicing, payment Fundamental difference ? February 2004 Ron McFadyen

16 Figure 5.8 Shipment Invoice Line Item Transaction fact table
Facts table Invoice date key Requested ship date key Actual ship date key Product key Quantity shipped Shipment Line Item On-Time Count Shipment Line Item Complete Count Ship Line Item Damage Free Count Satisfaction metrics (see pages ) Additive 1s and 0s What % of shipments to customers are on-time? February 2004 Ron McFadyen

17 Figure 5.10 Order Fulfillment Accumulating fact table
Facts table Order day key Backlog date key Product key Order quantity Shipment quantity Order to manufacturing release lag Many dates Lags could be presented in a view (see page 130) What is this view? February 2004 Ron McFadyen


Download ppt "Review of Major Points Star schema Slowly changing dimensions Keys"

Similar presentations


Ads by Google