The Date Dimension in Analysis Services

  • VincentRainardi

    SSCrazy

    Points: 2905

    Comments posted to this topic are about the item The Date Dimension in Analysis Services

  • Calvin Lawson

    SSChampion

    Points: 11030

    Great article, Vincent, though I found the non-date musings WAY, WAY more interesting that the actual information on the date dimension. I'm in a project right now where we don't have FK relationships in the datamart, and this surprised me. Nice to know I'm not crazy to think it odd, though.

    Keep up the writing and the great tips!

    Signature is NULL

  • SQL-DBA

    Hall of Fame

    Points: 3004

    Liked it so much I bought the book.

  • Zanoni Labuschagne-766625

    SSC Enthusiast

    Points: 197

    Good, solid article on the date dimension.

    I love role-playing dimensions - they can expand business users' understanding of their data to points that they had never considered.

    For example, one of the solutions I had implemented was a warehouse for a medical insurer. On the date dimension, I added an attribute called "Season", which would have members like "Summer", "Autumn", "Winter", and "Spring".

    Initially they only wanted to track the seasonality of certain treatments e.g. do people visit GP's more in winter than in summer?

    BUT

    One day they were slicing and dicing, and suddenly they saw they could use the same date dimension to track policy movements - they could see e.g. that more clients would join in autumn (just before the winter) compared to other seasons... Suddenly they had another perspective on their data, and his new view would have an impact on their marketing campaigns...

    The date dimension is an absolute treasure in BI solutions, and allows analysts to bring together data, and gain real insight, into the movements of their business


    _____________________________________________________________________
    Select 'Remember, we were all newbies once'
    From Truth
    Order by Experience

    _____________________________________________________________________
  • Mike C

    SSC-Insane

    Points: 23224

    Got the book, reading it now. Great stuff!

    I have a question for you though - I like to have a very large date dimension because the date ranges I deal with can be very long. In fact, they can cover up to 70 years of historical dates (throw in an additional +20, 30, 40 years for future dates). Not all dates fall in this range though, some might only cover a range of -20 to +20 years from the current year. When I role play with the same date dimension (-70 to +40 years for instance), SSAS pumps way too many dates into the cube with no data in them. What's your advice for limiting the date ranges for different date values?

    Thanks, and again great article!

    Mike C

  • Piers Williams

    SSC Enthusiast

    Points: 164

    'Although BIDS 2008 advised to hide the attributes used in the hierarchy, in my experience some users would still prefer to see those attributes. This enables them to use (for example) the month attribute directly either as a slicer or filter, without navigating through the Year-Month-Date hierarchy.'

    But surely the point here is that users always get massively confused between the month attribute and the month-of-year attribute. Making month only appear as part of the year-month-date heirachy makes it's this-is-a-specific-month role much clearer, leaving the month-of-year to be used as a slicer, which is normally what people want.

  • VincentRainardi

    SSCrazy

    Points: 2905

    Dear all, I'd like to thank you all for reading this article and also for your comments.

    Hi Mike, when different ranges are required we can create several Named Queries with different WHERE clauses and then create a date dimension for each Named Query.

    Hi Piers, you are right, sometimes users get confused between month and month-in-year and making month as part of the hierarchy avoids this confusion.

  • Anipaul

    SSC-Insane

    Points: 24681

    Good article. 🙂

  • Mike C

    SSC-Insane

    Points: 23224

    Vincent Rainardi (11/29/2008)


    Dear all, I'd like to thank you all for reading this article and also for your comments.

    Hi Mike, when different ranges are required we can create several Named Queries with different WHERE clauses and then create a date dimension for each Named Query.

    Hi Piers, you are right, sometimes users get confused between month and month-in-year and making month as part of the hierarchy avoids this confusion.

    OK thanks. Is there an advantage (performance-wise or other) to using SSAS Named Queries over doing it in a SQL view? I was thinking of using a SQL view with some table-driven logic built in to limit the date ranges to the min and max ranges for a specific column/attribute.

  • VincentRainardi

    SSCrazy

    Points: 2905

    Hi Mike, using named queries gives us more flexibility, i.e. we can modify the cube without modifying the database structure. Using views gives performance improvements (processing time) if there are many joins and grouping in the SQL, involving large amount of source rows (>10m) and the views are indexed. For example, a complex DSV SQL for a large measure group could benefit from an indexed view. For a date dimension sourced from a single table with 40k rows I don't think there will be differences on performance between named query and view. What I meant with performance here is the cube processing time; OLAP query time is not affected either way, unless it is a ROLAP partition.

    Another advantage of using views is code maintainability. It is beneficial in situations where the cube has many partitions and the partition source SQL queries are complex (long). The SQL queries for these partitions are almost identical except the WHERE clause used for partitioning. Putting these queries on a view would make them easier to maintain. For example, to add a measure we would only need to modify 1 view, rather than modifying the SQL on each partition.

  • Rick Todd

    Hall of Fame

    Points: 3302

    I found this article interesting. I feel like we have our Date dimension dialed, but it's always worth reading an article from someone that knows what they're talking about. And sure enough I found some interesting ideas.

    Now, a question for you and for the people hopefully tracking the posts: what's your solution for reusing the code if you end up doing multiple DSV statements or Views? Do you just rebuild the Date Dimension from scratch each time? Do you copy and past the existing Date.dim file and search and replace? How do you maintain that code going forward? I ask partly because I would like to embrace the different date ranges (we have some Facts with 35 years of data, and others with only 1 or 2, for example) but don't really want to maintain 4 different date dimensions.

    Please post thoughts!

    Cheers,

    Rick


    Rick Todd

  • VincentRainardi

    SSCrazy

    Points: 2905

    Hi Rick, I create the date dimension from scratch. I never modified the SSAS project files directly (except for a few rare cases), I always use BIDS* to edit/create the SSAS objects. In the current project I put all the DSV queries in an SSMS project and version control it in VSS, in the same solution folder as the SSAS project.

    Kind regards,

    Vincent

    *Occasionally I use AMO.

  • erin-590196

    SSC Enthusiast

    Points: 115

    Hi. This article is great. I was just wondering when part 2 might be available. I'm interested in all of the topics listed, but especially the part on "Enabling users to select a date (or month) to be used in calculated measure using 'from date' and 'to date'." Thanks.

  • VincentRainardi

    SSCrazy

    Points: 2905

    Hi erin, I sent part 2 on 31st December so hopefully it would be published soon.

    Vincent

  • BudaCli

    Hall of Fame

    Points: 3378

    Thanks and that’s a good article but I have a question though.

    I have 2 dimensions stored in the same SQL table (data mart).

    Data for my date dimension is stored for 2 cycles. Both cycles have a 12 month period. The first cycle is from January to December and the other cycle is from April to March.

    One row is used to store both cycles in the table.

    See below for my dimensionTimeTable:

    DateSeq CalendarDate Yr1 Yr2 Monthname1 Yr1MonthNr Yr2MonthNr Yr1QNr Yr2QNr

    20090301 2009-03-01 2009 2008 March 03 12 01 04

    20090331 2009-03-31 2009 2008 March 03 12 01 04

    20090401 2009-04-01 2009 2009 April 04 01 02 01

    I have one time dimensions in the cube with two hierarchies. They are both represented in two hierarchies with each hierarchy representing time cycles mentioned above.

    My problem is that cycle one works fine while measuring anything but cycle2 only measures the current month and does not show any values for previous months.

    Your help regarding above will be appreciated.

    My problem is that

    What you don't know won't hurt you but what you know will make you plan to know better

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply