SlideShare a Scribd company logo
1 of 39
Dimensional Modeling for
SQL Server Analysis Services

James Snape
Application Development Consulting
Microsoft Limited
The Kimball Process
Session Objectives

  Why do we need a dimensional model?
  What is a dimensional model?
  How do you design a dimensional model?
Dimensional Models are for Users
The Wrong Model

  OLTP != OLAP

                                        ProductSubcategory (Production) ProductCategory (Production)




                   ProductModel (Production) Product (Production)               ProductInventory (Production)

                                                                                                           PurchaseOrderDetail (Purchasing)




                  SalesPerson (Sales)                                                                       PurchaseOrderHeader (Purchasing)


                                                                                Employee (HumanResources)
                Store (Sales)
                                                Person (Person)

                                                                                                            Vendor (Purchasing)
                                                                                                            SalesReason (Sales)


                                                                                SalesOrderHeader (Sales)
                   Customer (Sales)


                                                                                                            SalesOrderHeaderSalesReason (Sales
        SalesTerritory (Sales)

                                                                                SalesOrderDetail (Sales)
Dimensional Model/Star Schema

  Single central fact
  Multiple denormalized dimensions


                            DimPromotion



     DimProduct                                               DimEmployee


                            FactResellerSales




                                                DimReseller
                  DimTime
The Four Steps

Choose the Business Process


   Declare the Grain


      Identify the Dimensions


         Identify the Facts
Choose the
Business Process
Follow the Value Chain



Manufacture   Inventory   Order   Delivery   Sale




  Common dimensions
    Product
    Item
    Date
Enterprise Bus Architecture

            Sales Inventory Orders Delivery Finance
                                           
Time
                                              
Employee
                                             
Customer
                                     
Product
                                     
Location
             
Promotion
                                             
Store
Declare the Grain
Fundamental Grains

  Transaction (or line item)
  Periodic snapshot e.g. Bank balance
  Accumulating snapshot e.g. Order state
Identify the
Dimensions
High Level Dimensional Model
                                 Promotion
     Sales Reason                                                Order Date
                              Start Date
     Reason Type        Discount Percent                               Year
            Reason             Category                             Month
                                                                 Day
                                                             Is Weekend




                               Internet
Sales Territory                                                         Ship Date
     Country   State
                                Sales                  Is Weekend Day Month Year


                                                         Is Weekend
             Product Name                                      Day
                Colour                                            Month
          Category                                                    Year
                                           Gender
         SKU
                                           City
    Product                                                        Delivery Date
                                           Full Name
                                           Customer ID

                                 Customer
Attribute Keys and Names

  All attributes have both a key and a name
  Keys must be unique
            Cust ID   Full Name      Marital   City          Country
            MJ0001    Mary Jones     S         London        UK

     Attribute             Key                        Name
     Customer ID           Cust ID                    Cust ID
     Full Name             Cust ID                    Full Name
     Marital Status        Marital                    Marital
     City                  City                       City
     Country               Country                    Country
Attribute Relations
and Hierarchies
                                              Country


Country
                                               State                    Marital


                                                City         Gender     Gender


 State
                                              Customer      Customer   Customer




                                        Age
          Gender              Marital
 City                                         Customer        State     Gender




                                                City         Country    Marital
                   Customer




          Attributes                                     Hierarchies
Slowly Changing Dimensions

  Change happens!
Type I: Overwrite the attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country

     1          MJ0001    Mary Jones   S         London   UK




                  Cust Key     Sales Amount
                  1            £400
Type I: Overwrite the attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country

     1          MJ0001    Mary Smith   M         London   UK




                  Cust Key     Sales Amount
                  1            £400
Type I: Overwrite the attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country

     1          MJ0001    Mary Smith   M         London   UK




                  Cust Key     Sales Amount
                  1            £400

                  1            £200

                  1            £150
Type II: Add a new dimension row

  Cust Key   Cust ID   Full Name    Marital   City     Country   Valid From   Valid To

  1          MJ0001    Mary Jones   S         London   UK        14/12/2000   NULL




               Cust Key     Sales Amount
               1            £400
Type II: Add a new dimension row

  Cust Key   Cust ID   Full Name    Marital   City     Country   Valid From   Valid To

  1          MJ0001    Mary Jones   S         London   UK        14/12/2000   01/02/2009

  2          MJ0001    Mary Jones   S         Leeds    UK        01/02/2009   NULL




               Cust Key     Sales Amount
               1            £400
Type II: Add a new dimension row

  Cust Key   Cust ID   Full Name    Marital   City     Country   Valid From   Valid To

  1          MJ0001    Mary Jones   S         London   UK        14/12/2000   01/02/2009

  2          MJ0001    Mary Jones   S         Leeds    UK        01/02/2009   NULL




               Cust Key     Sales Amount
               1            £400

               2            £200

               2            £150
Type III: Add a new attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country

     1          MJ0001    Mary Jones   S         London   UK




                  Cust Key     Sales Amount
                  1            £400
Type III: Add a new attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country   Previous Country

     1          MJ0001    Mary Jones   S         London   USA       UK




                  Cust Key     Sales Amount
                  1            £400
Type III: Add a new attribute

     Cust Key   Cust ID   Full Name    Marital   City     Country   Previous Country

     1          MJ0001    Mary Jones   S         London   USA       UK




                  Cust Key     Sales Amount
                  1            £400

                  1            £200

                  1            £150
Date and Time

  Create your own date dimension
  Attribute keys must be unique
    “January” vs. “January 2009”
  Time of day – do you really need it?
  Time zones – do you really need them?
  Pre-calculate durations into fact rows

  Use calculated surrogate dimension keys
    E.g. Key = 10000 x year + 100 x month + day
Role Playing Dimensions
Parent-Child Dimensions

  How do you model composite
  or hierarchical structures?
    E.g. Bill of Materials or
    Employee/Manager
Mini-Dimensions

  How do you manage high frequency, low
  cardinality change in a dimension?
    Country




     State




                                            Age
              Gender              Marital          Current Location
     City




                       Employee
                                                  Employee Location
Degenerate Dimensions

  How do you deal with the high
  cardinality dimensions like
  “transaction number”?
Junk Dimensions

  How do you deal with the low
  cardinality, non-related
  dimensions like gender or
  other booleans?
Identify the Facts
Facts (Kimball) == Measures (Analysis Services)
What makes a good fact?

  Numeric
  Additive
  Yes you can have strings
  Yes you can have non-additive values
    e.g. Averages
  But they are not very useful
Fact-less Facts

  How to you record an event that has no
  measures?




                     NB: Attended always = 1
Semi-additive Measures and
Custom Rollups
  Semi-additive in Time
  Configurable by Account
Currency and Units of Measure

     How do you enable currency conversions?
     How do you represent amounts in different
     units?
       e.g. 400 bikes == 2 pallets == 10 shipping crates


     Put the conversion factors in the fact table
     Expose the calculated results in the cube
OR
     Use a separate conversion measure group
       See Exchange Rates in AdventureWorks
The Four Steps

Choose the Business Process


   Declare the Grain


      Identify the Dimensions


         Identify the Facts
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other
                                                                                           countries.
  The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to
changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of
                                                                                      this presentation.
                               MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related Content

Viewers also liked

20111206 Cloud Expo Nl Jaarbeurs 7 Dec
20111206 Cloud Expo Nl Jaarbeurs 7 Dec20111206 Cloud Expo Nl Jaarbeurs 7 Dec
20111206 Cloud Expo Nl Jaarbeurs 7 DecTheo Slaats
 
Is It Alright With You Text
Is It Alright With You TextIs It Alright With You Text
Is It Alright With You Textrlwoods
 
9/2008 - He quan tri co so du lieu (tt)
9/2008 - He quan tri co so du lieu (tt)9/2008 - He quan tri co so du lieu (tt)
9/2008 - He quan tri co so du lieu (tt)Quan
 
Periodontitis Agresivas. Conferencia
Periodontitis Agresivas. ConferenciaPeriodontitis Agresivas. Conferencia
Periodontitis Agresivas. ConferenciaRicardo Benza
 
Axfood Q12009 En
Axfood Q12009 EnAxfood Q12009 En
Axfood Q12009 EnAxfood
 
Creating content sales people will share
Creating content sales people will shareCreating content sales people will share
Creating content sales people will shareRob Humphrey
 
DigimarcDiscover_CaseStudy_Lucky_061714_FNL
DigimarcDiscover_CaseStudy_Lucky_061714_FNLDigimarcDiscover_CaseStudy_Lucky_061714_FNL
DigimarcDiscover_CaseStudy_Lucky_061714_FNLdkinpdx
 
CITI Presentation
CITI PresentationCITI Presentation
CITI Presentationamcneile
 
Attracting And Retaining Excellent E Es
Attracting And Retaining Excellent E EsAttracting And Retaining Excellent E Es
Attracting And Retaining Excellent E Esvickor
 
The Search
The SearchThe Search
The Searchbrookyd
 
What Is The Ed Tech Grant
What Is The Ed Tech GrantWhat Is The Ed Tech Grant
What Is The Ed Tech Grantvera.weber
 
Modern recruiter tips
Modern recruiter tipsModern recruiter tips
Modern recruiter tipsRob Humphrey
 
物件導向程式設計課程講義(98 ges hi版)
物件導向程式設計課程講義(98 ges hi版)物件導向程式設計課程講義(98 ges hi版)
物件導向程式設計課程講義(98 ges hi版)Hui-Shih Leng
 
Manual Illustrator Cs4
Manual Illustrator Cs4Manual Illustrator Cs4
Manual Illustrator Cs4Eunice Fusty
 

Viewers also liked (20)

20111206 Cloud Expo Nl Jaarbeurs 7 Dec
20111206 Cloud Expo Nl Jaarbeurs 7 Dec20111206 Cloud Expo Nl Jaarbeurs 7 Dec
20111206 Cloud Expo Nl Jaarbeurs 7 Dec
 
Is It Alright With You Text
Is It Alright With You TextIs It Alright With You Text
Is It Alright With You Text
 
9/2008 - He quan tri co so du lieu (tt)
9/2008 - He quan tri co so du lieu (tt)9/2008 - He quan tri co so du lieu (tt)
9/2008 - He quan tri co so du lieu (tt)
 
Periodontitis Agresivas. Conferencia
Periodontitis Agresivas. ConferenciaPeriodontitis Agresivas. Conferencia
Periodontitis Agresivas. Conferencia
 
Pscs3 keyboard shortcuts_pc
Pscs3 keyboard shortcuts_pcPscs3 keyboard shortcuts_pc
Pscs3 keyboard shortcuts_pc
 
Axfood Q12009 En
Axfood Q12009 EnAxfood Q12009 En
Axfood Q12009 En
 
Creating content sales people will share
Creating content sales people will shareCreating content sales people will share
Creating content sales people will share
 
DigimarcDiscover_CaseStudy_Lucky_061714_FNL
DigimarcDiscover_CaseStudy_Lucky_061714_FNLDigimarcDiscover_CaseStudy_Lucky_061714_FNL
DigimarcDiscover_CaseStudy_Lucky_061714_FNL
 
CITI Presentation
CITI PresentationCITI Presentation
CITI Presentation
 
Attracting And Retaining Excellent E Es
Attracting And Retaining Excellent E EsAttracting And Retaining Excellent E Es
Attracting And Retaining Excellent E Es
 
The Search
The SearchThe Search
The Search
 
What Is The Ed Tech Grant
What Is The Ed Tech GrantWhat Is The Ed Tech Grant
What Is The Ed Tech Grant
 
Modern recruiter tips
Modern recruiter tipsModern recruiter tips
Modern recruiter tips
 
物件導向程式設計課程講義(98 ges hi版)
物件導向程式設計課程講義(98 ges hi版)物件導向程式設計課程講義(98 ges hi版)
物件導向程式設計課程講義(98 ges hi版)
 
Milk
MilkMilk
Milk
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Tundra Ppt Delegado
Tundra Ppt DelegadoTundra Ppt Delegado
Tundra Ppt Delegado
 
Manual Illustrator Cs4
Manual Illustrator Cs4Manual Illustrator Cs4
Manual Illustrator Cs4
 
Sertifikats
SertifikatsSertifikats
Sertifikats
 
Dokumen kurikulum 2013
Dokumen kurikulum 2013Dokumen kurikulum 2013
Dokumen kurikulum 2013
 

Similar to Dimensional Modeling

Tirta ERP - Business Intelligence Layer
Tirta ERP - Business Intelligence LayerTirta ERP - Business Intelligence Layer
Tirta ERP - Business Intelligence LayerWildan Maulana
 
Adaptive Marketing - Monetization and Pricing Models for the New world
Adaptive Marketing - Monetization and Pricing Models for the New worldAdaptive Marketing - Monetization and Pricing Models for the New world
Adaptive Marketing - Monetization and Pricing Models for the New worldPinkesh Shah
 
Kishore jaladi-dw
Kishore jaladi-dwKishore jaladi-dw
Kishore jaladi-dwsam2sung2
 
Amazon Business Model
Amazon Business ModelAmazon Business Model
Amazon Business ModelCalvin Nguyen
 
Real-Time Customer Intelligence: The New Heartbeat for Growth and Profitability
Real-Time Customer Intelligence: The New Heartbeat for Growth and ProfitabilityReal-Time Customer Intelligence: The New Heartbeat for Growth and Profitability
Real-Time Customer Intelligence: The New Heartbeat for Growth and ProfitabilityPivotal Analytics (Cetas Analytics)
 
Dw design 2_conceptual_model
Dw design 2_conceptual_modelDw design 2_conceptual_model
Dw design 2_conceptual_modelClaudia Gomez
 

Similar to Dimensional Modeling (14)

Dwlogical0910
Dwlogical0910Dwlogical0910
Dwlogical0910
 
Data warehousing
Data warehousingData warehousing
Data warehousing
 
Tirta ERP - Business Intelligence Layer
Tirta ERP - Business Intelligence LayerTirta ERP - Business Intelligence Layer
Tirta ERP - Business Intelligence Layer
 
Duaa shah
Duaa shahDuaa shah
Duaa shah
 
Birdie Analysis
Birdie AnalysisBirdie Analysis
Birdie Analysis
 
Mis07
Mis07Mis07
Mis07
 
Adaptive Marketing - Monetization and Pricing Models for the New world
Adaptive Marketing - Monetization and Pricing Models for the New worldAdaptive Marketing - Monetization and Pricing Models for the New world
Adaptive Marketing - Monetization and Pricing Models for the New world
 
Kishore jaladi-dw
Kishore jaladi-dwKishore jaladi-dw
Kishore jaladi-dw
 
Retail Management
Retail Management Retail Management
Retail Management
 
Etsy Presentation
Etsy PresentationEtsy Presentation
Etsy Presentation
 
Amazon Business Model
Amazon Business ModelAmazon Business Model
Amazon Business Model
 
Real-Time Customer Intelligence: The New Heartbeat for Growth and Profitability
Real-Time Customer Intelligence: The New Heartbeat for Growth and ProfitabilityReal-Time Customer Intelligence: The New Heartbeat for Growth and Profitability
Real-Time Customer Intelligence: The New Heartbeat for Growth and Profitability
 
eVitaran-slides-Updated
eVitaran-slides-UpdatedeVitaran-slides-Updated
eVitaran-slides-Updated
 
Dw design 2_conceptual_model
Dw design 2_conceptual_modelDw design 2_conceptual_model
Dw design 2_conceptual_model
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Dimensional Modeling

  • 1. Dimensional Modeling for SQL Server Analysis Services James Snape Application Development Consulting Microsoft Limited
  • 3. Session Objectives Why do we need a dimensional model? What is a dimensional model? How do you design a dimensional model?
  • 5. The Wrong Model OLTP != OLAP ProductSubcategory (Production) ProductCategory (Production) ProductModel (Production) Product (Production) ProductInventory (Production) PurchaseOrderDetail (Purchasing) SalesPerson (Sales) PurchaseOrderHeader (Purchasing) Employee (HumanResources) Store (Sales) Person (Person) Vendor (Purchasing) SalesReason (Sales) SalesOrderHeader (Sales) Customer (Sales) SalesOrderHeaderSalesReason (Sales SalesTerritory (Sales) SalesOrderDetail (Sales)
  • 6. Dimensional Model/Star Schema Single central fact Multiple denormalized dimensions DimPromotion DimProduct DimEmployee FactResellerSales DimReseller DimTime
  • 7. The Four Steps Choose the Business Process Declare the Grain Identify the Dimensions Identify the Facts
  • 9. Follow the Value Chain Manufacture Inventory Order Delivery Sale Common dimensions Product Item Date
  • 10. Enterprise Bus Architecture Sales Inventory Orders Delivery Finance      Time   Employee    Customer   Product   Location  Promotion    Store
  • 12. Fundamental Grains Transaction (or line item) Periodic snapshot e.g. Bank balance Accumulating snapshot e.g. Order state
  • 14. High Level Dimensional Model Promotion Sales Reason Order Date Start Date Reason Type Discount Percent Year Reason Category Month Day Is Weekend Internet Sales Territory Ship Date Country State Sales Is Weekend Day Month Year Is Weekend Product Name Day Colour Month Category Year Gender SKU City Product Delivery Date Full Name Customer ID Customer
  • 15. Attribute Keys and Names All attributes have both a key and a name Keys must be unique Cust ID Full Name Marital City Country MJ0001 Mary Jones S London UK Attribute Key Name Customer ID Cust ID Cust ID Full Name Cust ID Full Name Marital Status Marital Marital City City City Country Country Country
  • 16. Attribute Relations and Hierarchies Country Country State Marital City Gender Gender State Customer Customer Customer Age Gender Marital City Customer State Gender City Country Marital Customer Attributes Hierarchies
  • 17. Slowly Changing Dimensions Change happens!
  • 18. Type I: Overwrite the attribute Cust Key Cust ID Full Name Marital City Country 1 MJ0001 Mary Jones S London UK Cust Key Sales Amount 1 £400
  • 19. Type I: Overwrite the attribute Cust Key Cust ID Full Name Marital City Country 1 MJ0001 Mary Smith M London UK Cust Key Sales Amount 1 £400
  • 20. Type I: Overwrite the attribute Cust Key Cust ID Full Name Marital City Country 1 MJ0001 Mary Smith M London UK Cust Key Sales Amount 1 £400 1 £200 1 £150
  • 21. Type II: Add a new dimension row Cust Key Cust ID Full Name Marital City Country Valid From Valid To 1 MJ0001 Mary Jones S London UK 14/12/2000 NULL Cust Key Sales Amount 1 £400
  • 22. Type II: Add a new dimension row Cust Key Cust ID Full Name Marital City Country Valid From Valid To 1 MJ0001 Mary Jones S London UK 14/12/2000 01/02/2009 2 MJ0001 Mary Jones S Leeds UK 01/02/2009 NULL Cust Key Sales Amount 1 £400
  • 23. Type II: Add a new dimension row Cust Key Cust ID Full Name Marital City Country Valid From Valid To 1 MJ0001 Mary Jones S London UK 14/12/2000 01/02/2009 2 MJ0001 Mary Jones S Leeds UK 01/02/2009 NULL Cust Key Sales Amount 1 £400 2 £200 2 £150
  • 24. Type III: Add a new attribute Cust Key Cust ID Full Name Marital City Country 1 MJ0001 Mary Jones S London UK Cust Key Sales Amount 1 £400
  • 25. Type III: Add a new attribute Cust Key Cust ID Full Name Marital City Country Previous Country 1 MJ0001 Mary Jones S London USA UK Cust Key Sales Amount 1 £400
  • 26. Type III: Add a new attribute Cust Key Cust ID Full Name Marital City Country Previous Country 1 MJ0001 Mary Jones S London USA UK Cust Key Sales Amount 1 £400 1 £200 1 £150
  • 27. Date and Time Create your own date dimension Attribute keys must be unique “January” vs. “January 2009” Time of day – do you really need it? Time zones – do you really need them? Pre-calculate durations into fact rows Use calculated surrogate dimension keys E.g. Key = 10000 x year + 100 x month + day
  • 29. Parent-Child Dimensions How do you model composite or hierarchical structures? E.g. Bill of Materials or Employee/Manager
  • 30. Mini-Dimensions How do you manage high frequency, low cardinality change in a dimension? Country State Age Gender Marital Current Location City Employee Employee Location
  • 31. Degenerate Dimensions How do you deal with the high cardinality dimensions like “transaction number”?
  • 32. Junk Dimensions How do you deal with the low cardinality, non-related dimensions like gender or other booleans?
  • 33. Identify the Facts Facts (Kimball) == Measures (Analysis Services)
  • 34. What makes a good fact? Numeric Additive Yes you can have strings Yes you can have non-additive values e.g. Averages But they are not very useful
  • 35. Fact-less Facts How to you record an event that has no measures? NB: Attended always = 1
  • 36. Semi-additive Measures and Custom Rollups Semi-additive in Time Configurable by Account
  • 37. Currency and Units of Measure How do you enable currency conversions? How do you represent amounts in different units? e.g. 400 bikes == 2 pallets == 10 shipping crates Put the conversion factors in the fact table Expose the calculated results in the cube OR Use a separate conversion measure group See Exchange Rates in AdventureWorks
  • 38. The Four Steps Choose the Business Process Declare the Grain Identify the Dimensions Identify the Facts
  • 39. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.