Master the Date Dimension Like a Time Lord

9
Master the Date Dimension Like a Time Lord Steve Wake Sr. Business Intelligence Consultant President, Denver SQL Server User Group MAKING BUSINESS INTELLIGENT www.pragmaticworks.c om

description

All data warehouses need a Date dimension to enable analysis by date. Most DW designers will just use a default one provided by the tools, but what if you need to set up custom holidays or want different calendars, such as Fiscal or Julian? You can have any Date dimension you want by using a single SQL script that can be modified and rerun as necessary to update the dimension. By the end of this session, you’ll be a Time Lord in your own company!

Transcript of Master the Date Dimension Like a Time Lord

Page 1: Master the Date Dimension Like a Time Lord

Master the Date Dimension Like a Time LordSteve Wake

Sr. Business Intelligence Consultant

President, Denver SQL Server User Group

MAKING BUSINESS INTELLIGENT www.pragmaticworks.com

Page 2: Master the Date Dimension Like a Time Lord

What is a Date Dimension?

• Dimension to track dates (usually by day)

• Can track multiple calendars (Julian, fiscal)

• Time should be in separate Dimension (if needed)

• One row per date/day

Page 3: Master the Date Dimension Like a Time Lord

What is a Time Dimension?

• Dimension to track time hours/minutes/seconds (depends on application)

• Keep time zones in mind

• Separate from Date Dimension for flexibility

• Only needs to cover 24 hours

Page 4: Master the Date Dimension Like a Time Lord

Why Date/Time Dimensions?

• Most reporting is done by date/time

• Track Holidays and other significant dates

• Do date calculations in SQL once

• Date/Time period comparisons

• Generate for years/decades easily

Page 5: Master the Date Dimension Like a Time Lord

Date/Time Dimension Types

• Calculated

• Tool Created

• Custom Physical

• Hybrid

Page 6: Master the Date Dimension Like a Time Lord

What to Include in the Date_DIM?

• Date as Integer for PK to make reload not break links (20130806)

• Date in multiple formats (“08/06/2013”, “Tuesday, August 6, 2013”, etc.)

• Multiple parts (Month, Day, Year, Month Text, Day Text, etc.)

• Holiday indicator (domestic/international/religious)

• Julian/Fiscal Calendars

• Calculated measures (Day # in week, Day # in month, Day # in year, Week # in month, Week # in year, etc.)

Page 7: Master the Date Dimension Like a Time Lord

Demo

• Date_DIM script

Page 8: Master the Date Dimension Like a Time Lord

Summary

• What & Why of Date/Time Dimensions

• Date Dimension Benefits

• What to Include in Date Dimension

• Doctor Who’s 50th Anniversary!

Page 9: Master the Date Dimension Like a Time Lord

ServicesSpeed development through training, and rapid development services from Pragmatic Works.

ProductsBI products to convert to a Microsoft BI platform and simplify development on the platform.

FoundationHelping those who do not have the means to get into information technology and to achieve their dreams.

See you soon…

My Email: [email protected] Blog: http://blog.wakebi.comMy Twitter: @stevewake