Title: Dimensional Modelling 101
1 How to build your ownSuper Model
Dimensional Modelling for Analysis Services
Darren GosbellPrincipal Consultant - James
Monroehttp//geekswithblogs.net/darrengosbell
2Agenda
- Why build a Dimensional Model?
- What is a Dimensional Model?
- Overview of some modelling techniques.
- What functionality does Analysis Services provide
to help us?
3Further Reading
- The Data Warehouse Toolkit by Ralph Kimball
Margy Ross - The Data Warehouse Lifecycle Toolkit by Ralph
Kimball Margy Ross
4Why Build a Dimensional Model
OLTP System Dimensional Model
Process Oriented Subject Oriented
Transactional Aggregate
Current Historic
5What is a Dimensional Model?
- A De-normalized database.
- Designed for ease of querying, not for
transactional updates. - Built to support aggregate queries
- Modelled around business subject areas.
6Facts Dimensions
- There are two main types of objects in a
dimensional model - Facts are quantitative measures that we wish to
analyse and report on. - Dimensions contain textual descriptors of the
business. They provide context for the facts.
7A Transactional Database
Countries
CountryID
Description
Addresses
AddressID
StateID
Street
States
StateID
CountryID
Desc
Customers
CustomerID
AddressID
Name
OrderHeader
OrderHeaderID
CustomerID
OrderDate
FreightAmount
Products
ProductID
Description
Size
OrderDetails
OrderHeaderID
ProductID
Amount
8A Dimensional Model
Customers
CustomerID
Name
Street
State
Country
Time
TimeID
Date
Month
Quarter
Year
FactSales
CustomerID
ProductID
TimeID
SalesAmount
Products
ProductID
Description
Size
Subcategory
Category
9Star Schema
10Snowflake Schema
11Building a Model - Facts
- You have to talk to the business.
- Identify Facts by looking for quantitative values
that are reported. - Make sure the granularity is right.
12Building a Model - Dimensions
- Identify Dimensions by listening for by words.
- Look for related attributes that should be part
of a single dimension. - Pay attention to how Dimensions change over
time and in relation to each other.
13Slowly Changing Dimensions -Handling Changes
over time
14If you dont consider changes over time
yourmodel will start out like this
15 but ending up like this!
16Type 1 Slowly Changing Dimension
- The simplest form
- Only updates existing records
- Overwrites history
17Type 1 Slowly Changing Dimension
CustomerID Code Name State Gender
1 K001 Miranda Kerr NSW F
CustomerID Code Name State Gender
1 K001 Miranda Kerr VIC F
18Type 2 Slowly Changing Dimension
- Allows the recording of changes of state over
time - Generates a new record each time the state
changes - Usually requires the use of effective dates when
joining to facts.
19Type 2 Slowly Changing Dimension
CustomerID Code Name State Gender Start End
1 K001 Miranda Kerr NSW F 1/1/09 ltNULLgt
CustomerID Code Name State Gender Start End
1 K001 Miranda Kerr NSW F 1/1/09 23/2/09
2 K001 Miranda Kerr VIC F 24/2/09 ltNULLgt
23/2/09
20Type 3 Slowly Changing Dimension
- De-normalized change tracking
- Only keeps a limited history
- Stores changes in separate columns
21Type 3 Slowly Changing Dimension
CustomerID Code Name Current State Gender Prev State
1 K001 Miranda Kerr F ltNULLgt
NSW
VIC
22Relationships between facts
and dimensions
23Regular Relationships
- Most Common relationship
- Works like an inner join between the fact and
dimension
24DEMO
25Many to Many Relationships
- Allows for the situation where you want to
associate more than one member from a dimension
with a single fact.
26Scenario
- Bank Account Transactions - each one has an
Account - Accounts have one or more Customers
- Each Customer has one or more Accounts
27Demo
- Many-to-Many Relationships
28Bank Accounts
Account 1
1,010
Account 2
2,010
Person Account Amount
Albert 1 1,010
Albert 2 2,010
Betty 2 2,010
TOTAL 5,030
3,020
29Bank Accounts
30Referenced Relationships
- Joins a dimension to a fact table through another
intermediate dimension
31Demo
32Reference Relationships
SELECT Measures.Amount ON Columns
Geography.City.1 ON ROWS FROM Balances
Customer
CustomerID
FullName
CityID
33Materialized Reference Relationships
CustomerID
FullName
CityID
100
Albert
1
TimeID
CustomerID
Amount
200801
100
1000
34Fact Relationships
- Used when a table plays both the role of a
dimension and a fact. - Sometimes also known as a degenerate dimension.
35DEMO
36No Relationship
- Used for controlling calculations when you want
to influence the context of the calculation
without changing the context of the data.
37DEMO
38Key Take Aways
- Why to build a dimensional model.
- What makes up a dimensional model.
- How implement various modelling techniques in
Analysis Services (2005 2008).
39Thank You
- Darren Gosbell
- http//geekswithblogs.net/darrengosbell