Dimensional modeling 2

advertisement
Dimensional modeling 2
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
2
Star for Retail
Dimension2
Dimension3
Fact
Dimension1
Dimensionn
Star for Retail
4
Star for Retail
ETL: Avoid normalization
5
Star for Retail
Hierarchies
Year
Region
Quarter
State
Month
District
Region
Category
Sales Zone
Brand
Product
Week
Date
City
6
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
7
Case study: Inventory
8
Two Inventory models
• Inventory Periodic Snapshot
• Inventory Transactions
9
Inventory Periodic Snapshot
10
Inventory Periodic Snapshot
11
Inventory Periodic Snapshot
0
adding quantity-on-hand along
other dimensions such as store can
provide a meaningful measure for the
total quantity of products the stores are
holding at any given point in time
12
(i.e., on particular date)
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
13
Semi-additive facts
• Account balances is another typical
example of semi-additive facts
14
Non-additive facts
• Non-additive facts are facts which cannot be added
meaningfully across any dimensions
• Examples of non-additive facts include:
– Textual facts: Adding textual facts does not result in any
number
• However, counting textual facts may result in a sensible number
– Per-unit prices: Adding unit prices does not produce any
meaningful number
– Percentages and ratios: A ratio, such as gross margin, is nonadditive
– Measures of intensity: Measures of intensity such as the room
temperature are non-additive across all dimensions
15
How can Quantity-on-hand
be calculated across date?
Observation: if we average the quantity on hand to find out the monthly
average balance during each month of the year, then it is valid!
But how exactly should we do the averaging?
16
How can Quantity-on-hand
be calculated across date?
Mon
Tue
Wed
Thu
Fri
Prod A
1
1
2
2
1
Prod B
2
1
2
2
1
SumDate
3
2
4
4
2
TotalSum
15
AVG
= TotalSum / 10 = 15 / 10 = 1.5
AVG_DATE = TotalSum / 5 = 15 / 5 = 3
17
Inventory Periodic Snapshot
Size considerations
18
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
19
Inventory Transactions
20
Inventory Transactions
21
Inventory Transactions
In practice: inventory as combination of periodic snapshot and transactions
22
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
23
Value Chain Integration
24
Data Warehouse Bus
Architecture
25
Data Warehouse Bus
Architecture
26
Data Warehouse Bus
Architecture
27
Learning Objectives
•
•
•
•
•
Revision of Retails Star Schema
Inventory Models
Semi-additive facts
Data Warehouse Bus Architecture
Conformed dimensions
28
Conformed dimensions
• DW Bus determines dimensions common in several
business processes
– Each business process will be tied together through these
common (conformed) dimensions
• To create conformed dimensions, the various
businesses must agree on their definitions
– Example:
• Product dimension shared by retail sales, inventory, purchase order, etc.
• Must agree on a common definition of the Product dimension
• The Product dimension becomes a conformed dimension shared across all
these business processes
– Agreement on definitions of common entities, such as product
and customer, can be difficult because they are different from
one business process to another
29
Establishing conformity
• Developing a set of shared, conformed
dimensions is a significant challenge
• All dimensions common across business
processes must represent the dimension
information in the same way
• Each business process will typically have its
own schema that contains:
– a fact table
– several conforming dimension tables
– and dimension tables unique to the specific business
function
30
Establishing conformity
■ Option 1: Identical dimensions with the same keys, labels,
definitions and values
Sales Schema
Inventory Schema
Item Key
DATE KEY
Item Desc.
ITEM KEY
Brand Desc.
STORE KEY
Category
PROMO KEY
..
Sales Fact
Item Key
DATE KEY
Item Desc.
ITEM KEY
Brand Desc.
Category
..
STORE KEY
Inventory Fact
Establishing conformity
■ Option 2: “Subset” of base dimension
Sales Schema
Item Key
DATE KEY
DATE KEY
Item Desc.
ITEM KEY
Day-of-week
Brand Desc.
STORE KEY
Week Desc
Category
PROMO KEY
Month Desc
Desc.
Sales $
..
Forecast Schema
Item key Item Desc
Brand Desc
0001
Cheerios
Cheerios 10oz
Category Desc
Cereal
Brand Key
Month Key
Month KEY
Brand Desc.
Brand Key
Month Desc
Category
Estimate
Desc.
Sales $
..
Brand key
Brand Desc
1001
Cheerios
Category Desc
Cereal
Establishing conformity
■ Option 2: “Subset” of base dimension
Department
Category
Subcategory
Brand
33
Product
Establishing conformity
Department
Category
Subcategory
Brand
Product
34
Data Warehouse Bus
Architecture
What are conformed facts?
• Fact conformation means that: if two facts exist in two
separate fact tables, then they must have the same
name, units, and definition
• Examples:
– Revenue and Profit are each facts that must be conformed
– By conforming a fact, then all business processes agree on one
common definition for the revenue and profit measures
35
Summary
36
Download