390 likes | 507 Views
How to build your own… Super Model. Dimensional Modelling for Analysis Services. Darren Gosbell Principal Consultant - James & Monroe http://geekswithblogs.net/darrengosbell. Agenda. Why build a Dimensional Model? What is a Dimensional Model? Overview of some modelling techniques.
E N D
How to build your own…Super Model Dimensional Modelling for Analysis Services Darren GosbellPrincipal Consultant - James & Monroehttp://geekswithblogs.net/darrengosbell
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?
Further Reading • “The Data Warehouse Toolkit” by Ralph Kimball & Margy Ross • “The Data Warehouse Lifecycle Toolkit” by Ralph Kimball & Margy Ross
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.
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.
Star Schema factSales dimProduct dimCustomer dimTime … … ProductID TimeID CustomerID SalesAmount ProductID ProductName SubCategoryName CategoryName
Snowflake Schema factSales dimProduct dimSubCategory dimCategory SubcategoryID CategoryID Description CategoryID Description ProductID SubcategoryID Description ProductID TimeID CustomerID SalesAmount
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”.
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.
If you don’t consider changes over time yourmodel will start out like this…
Type 1 Slowly Changing Dimension • The simplest form • Only updates existing records • Overwrites history
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.
Type 2 Slowly Changing Dimension 23/2/09
Type 3 Slowly Changing Dimension • De-normalized change tracking • Only keeps a limited history • Stores changes in separate columns
Type 3 Slowly Changing Dimension NSW VIC
Relationships between facts and dimensions
Regular Relationships • Most Common relationship • Works like an inner join between the fact and dimension
Many to Many Relationships • Allows for the situation where you want to associate more than one member from a dimension with a single fact.
Scenario • Bank Account Transactions - each one has an Account - Accounts have one or more Customers - Each Customer has one or more Accounts
Bank Accounts Albert Betty $3,020
Bank Accounts • The relational schema
Referenced Relationships • Joins a dimension to a fact table through another “intermediate” dimension
Reference Relationships Geography SELECT {[Measures].[Amount]} ON Columns {[Geography].[City].&[1]} ON ROWS FROM [Balances] CityID CityName 1 Adelaide Customer CustomerID FullName CityID 100 Albert 1 101 Betty 1 TimeID CustomerID Amount 200801 100 $1000 200801 101 $2000
Materialized Reference Relationships CityID CityName 1 Adelaide CustomerID FullName CityID 100 Albert 1 TimeID CustomerID Amount CityID 200801 100 $1000 1
Fact Relationships • Used when a table plays both the role of a dimension and a fact. • Sometimes also known as a degenerate dimension.
Fact Relationships DEMO
No Relationship • Used for controlling calculations when you want to influence the context of the calculation without changing the context of the data.
No Relationship DEMO
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).
Thank You Darren Gosbell http://geekswithblogs.net/darrengosbell