Date Dimension: One Script for All Steve Wake DW/BI Engineer III, National CineMedia Chapter Leader, Mile Hi Power BI User Group
What is a Date Dimension? Dimension to track dates (usually by day) Can track multiple calendars (Gregorian, Julian, Fiscal) Time should be in separate Dimension (if needed) One row per date/day 2 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017
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 3 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017
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 4 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017
Date/Time Dimension Types Calculated Tool Created Custom Physical Hybrid 5 | 2/11/2017 SQLSaturday #358 – Albuquerque 2015
What to Include in the Date_DIM? Date as Integer for PK to make reload not break links (20170211) Date in multiple formats (“02/11/2017”, “Saturday, February 11, 2017”, etc.) Multiple parts (Month, Day, Year, Month Text, Day Text, etc.) Holiday indicator (domestic/international/religious) Gregorian/Julian/Fiscal Calendars Calculated measures (Day # in week, Day # in month, Day # in year, Week # in month, Week # in year, etc.) 6 | 2/11/2017 SQLSaturday #358 – Albuquerque 2015
Demo dimDate script dimTime script 7 | 2/11/2017 7 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017
Summary What & Why of Date/Time Dimensions Date Dimension Benefits What to Include in Date Dimension What to Include in Time Dimension 8 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017
Contact swake@ncm.com @stevewake on Twitter LinkedIn, Google+ Blog – http://wakebi.com Mile Hi Power BI – http://milehipowerbi.com 9 | 2/11/2017 SQLSaturday #596 – Denver BI Edition 2017