BLOG

Semi-additive measures, multiple measure groups and time dimensions

20.09.2009 Hilmar Buchta

SQL Server 2005 | SQL Server 2008

My last post was about the effects of semi-additive measures on dimensions other than the time dimension. Now let’s focus on the situation of having more than one dimension of type ‚time‘ in our cube.

As we’ve seen from many posts this may result in our aggregations are not what we would expect. The effect becomes clearly visible with semi-additive measures (although you should always set the type of your time dimension in order to provide useful information to the OLAP-clients). Only the first dimension is treated as a time-dimension while all following time dimensions are treated as normal dimensions. If, for example, a specific measure is set to aggregate as ‚average of children‘ this will only consider the first time dimension as the one to compute the average for.

Now, let’s get a little bit more detailed on that ‚first‘ time dimension. In this context, ‚first‘ relates to the order of the dimensions in a cube which can be changed by drag’n’drop on the first tab of the cube file editor (lower left corner):

image

Now, imagine we have two dimensions of type ‚time‘ in our cube. Let’s name them ‚Local Date‘ and ‚GMT Date‘. The ‚Local Date‘ dimension comes first. The questions which of those dimensions is actually considered the time dimension of a measure group depends on the dimension usage:

  • If the measure group is only linked to the ‚Local Date‘ dimension, this becomes the time dimension for the measure group
  • If the measure group is only linked to the ‚GMT Date‘ dimension, this becomes the time dimension for the measure group
  • If the measure group is linked to both dimensions, the ‚Local Date‘ dimension becomes the time dimension for the measure group (because it appears first in the dimension list of the cube)

In this sense, ‚linked‘ really means the dimension usage as being defined on the dimension usage tab of the cube file editor. Links that are only created in the date source view but not modeled in the cube have no influence in choosing the first time dimension. For example, if the measure group ‚Utilization GMT‘ is linked to both time dimensions (Local Date and GMT date) in the date source view but only to ‚GMT Date‘ in the dimension usage, then the ‚GMT Date‘ dimension would be the time dimension for the measure group even if the ‚Local Date‘ dimension appears in front of the ‚GMT Date‘ dimension. Sounds confusing? Ok, here is the quintessence:

You may have multiple dimensions of type ‚time‘ in your cube, but you should avoid measure groups that have more than one of them in their dimension usage.

In any case, having more than one time dimension in a cube can be error-prone, even if you follow the above recommendation. It would have been better if Microsoft put the ‚time dimension‘ as an attribute to the measure group instead of simple choosing the one that first appears in the cube definition. If somebody changes the order for any reason the aggregation behavior in one or more of your measure groups might change too.

You might not going to face a situation with more than one time dimension too often. But what about role playing time dimensions and semi-additive measures? My next post will be about this topic.

Your email address will not be published. Required fields are marked *

Join #teamoraylispeople

Gestalte mit uns
die Welt der Daten