[Mondrian] Date dimensions and attribute-hierarchies in mondrian 4

Julian Hyde jhyde at pentaho.com
Tue Apr 10 19:53:10 EDT 2012


On Apr 10, 2012, at 3:17 PM, Pedro Alves wrote:

This same questions comes up rath frequently from a different number of users (blogged about it nearly 3 years ago - http://pedroalves-bi.blogspot.pt/2009/03/interesting-olap-date-crosstab-question.html ) where I had to use dummy dimensions to be able to do this. Now I can do the same with dummy hierarchies but is equally a hack, imo.

I can see where you're headed with one attribute per hierarchy, but unless i'm seeing this wrong, we'd still need one or more "normal" date hierarchies (the ones with year-quarter-month-day) to do the usual drilldown, resulting in about 8 or more hierarchies just for the date dimension when we include week combinations. Wouldn't this result in a fairly complicated scenario for the end user (even mdx writer) that would have to now exactly which level to drag? In the end James' business question, as well as mine, is simply "months by year" which should be relatively straightforward to answer.

I know and rerspect the decision to follow ssas behaviour, but would it make sense, even if by popular demand :) to add an option in mondrian properties to allow this, defaulting to false or something?

If your concern is that it is a lot of extra effort to create attribute hierarchies, the answer is no. Attribute hierarchies are necessary because MDX can't see attributes; it can only see dimensions, hierarchies, levels, and members. So, if you want to include the "year" attribute in a query, it needs to be either a hierarchy or a level. But in mondrian-4, It is very easy to create a hierarchy for an attribute. It couldn't be easier. You just declare the attribute:

  <Attribute name='Year' keyColumn='the_year' levelType='TimeYears'/>

and an attribute hierarchy is created automatically. (Include 'hasHierarchy=false' to disable the hierarchy.)

Are attribute hierarchies a hack? Maybe, but a very elegant one: they prevent us from having to add another concept to the MDX language, and they don't require any extra work by the schema designer.

If you are concerned that your user would be confused by "quarter" and "quarter of year". There IS a difference between "quarter within year" (40 distinct values over a 10 year period) and "quarter of year" (4 distinct values), so we provide them for anyone that cares about the distinction. But if you think that your users would be confused, you should create one of the attributes, or flag objects you think might be confusing as non-visible.

Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20120410/43ff90c3/attachment.html 


More information about the Mondrian mailing list