Download presentation
Presentation is loading. Please wait.
1
How to build your own… Super Model Dimensional Modelling for Analysis Services Darren Gosbell Principal Consultant - James & Monroe http://geekswithblogs.net/darrengosbell
2
Agenda Why build a Dimensional Model? What is a Dimensional Model? Overview of some modelling techniques. What functionality does Analysis Services provide to help us?
3
Further Reading “The Data Warehouse Toolkit” by Ralph Kimball & Margy Ross “The Data Warehouse Lifecycle Toolkit” by Ralph Kimball & Margy Ross
4
Why Build a Dimensional Model OLTP SystemDimensional Model Process OrientedSubject Oriented TransactionalAggregate CurrentHistoric
5
What 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.
6
Facts & 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.
7
A Transactional Database OrderDetails OrderHeaderID ProductID Amount OrderHeader OrderHeaderID CustomerID OrderDate FreightAmount Products ProductID Description Size Customers CustomerID AddressID Name Addresses AddressID StateID Street States StateID CountryID Desc Countries CountryID Description
8
A Dimensional Model FactSales CustomerID ProductID TimeID SalesAmount Products ProductID Description Size Subcategory Category Customers CustomerID Name Street State Country Time TimeID Date Month Quarter Year
9
Star Schema ProductID TimeID CustomerID SalesAmount factSales ProductID ProductName SubCategoryName CategoryName dimProduct … dimCustomer … dimTime
10
Snowflake Schema ProductID TimeID CustomerID SalesAmount factSales ProductID SubcategoryID Description dimProduct SubcategoryID CategoryID Description dimSubCategory CategoryID Description dimCategory
11
Building 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”.
12
Building 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.
13
Slowly Changing Dimensions - Handling Changes over time
14
If you don’t consider changes over time your model will start out like this…
15
… but ending up like this!
16
Type 1 Slowly Changing Dimension The simplest form Only updates existing records Overwrites history
17
Type 1 Slowly Changing Dimension CustomerIDCodeNameStateGender 1K001Miranda KerrNSWF CustomerIDCodeNameStateGender 1K001Miranda KerrVICF
18
Type 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.
19
Type 2 Slowly Changing Dimension CustomerIDCodeNameStateGenderStartEnd 1K001Miranda KerrNSWF1/1/09 23/2/09 CustomerIDCodeNameStateGenderStartEnd 1K001Miranda KerrNSWF1/1/0923/2/09 2K001Miranda KerrVICF24/2/09
20
Type 3 Slowly Changing Dimension De-normalized change tracking Only keeps a limited history Stores changes in separate columns
21
Type 3 Slowly Changing Dimension CustomerIDCodeNameCurrent State GenderPrev State 1K001Miranda KerrF VIC NSW
22
Relationships between facts and dimensions
23
Regular Relationships Most Common relationship Works like an inner join between the fact and dimension
24
DEMO Regular Relationships
25
Many to Many Relationships Allows for the situation where you want to associate more than one member from a dimension with a single fact.
26
Scenario Bank Account Transactions - each one has an Account - Accounts have one or more Customers - Each Customer has one or more Accounts
27
DEMO Many-to-Many Relationships
28
PersonAccountAmount Albert#1$1,010 Albert#2$2,010 Betty#2$2,010 TOTAL$5,030 $3,020 Bank Accounts Account #1 $1,010 Account #2 $2,010 AlbertBetty
29
Bank Accounts The relational schema
30
Referenced Relationships Joins a dimension to a fact table through another “intermediate” dimension
31
DEMO Reference Relationships
32
CustomerIDFullNameCityID 100Albert1 SELECT {[Measures].[Amount]} ON Columns {[Geography].[City].&[1]} ON ROWS FROM [Balances] TimeID 200801 CustomerID 100 Amount $1000 200801101$2000 CityID 1 CityName Adelaide Geography Customer 101Betty1
33
Materialized Reference Relationships CustomerID 100 FullName Albert CityID 1 1 CityName Adelaide TimeID 200801 CustomerID 100 Amount $1000 CityID 1
34
Fact Relationships Used when a table plays both the role of a dimension and a fact. Sometimes also known as a degenerate dimension.
35
DEMO Fact Relationships
36
No Relationship Used for controlling calculations when you want to influence the context of the calculation without changing the context of the data.
37
DEMO No Relationship
38
Key Take Aways Why to build a dimensional model. What makes up a dimensional model. How implement various modelling techniques in Analysis Services (2005 & 2008).
39
Thank You Darren Gosbell http://geekswithblogs.net/darrengosbell
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.