SSAS: There is no such thing as an Attribute in MDX!

In MDX in SSAS the term "attribute" occasionally gets used interchangeably with "hierarchy" and "level", but it's not technically accurate.

In SSAS, MDX has concepts of Dimensions, Hierarchies and Levels, but not Attributes. Attributes and Attribute Relationships are design time concepts that are understood by the storage engine, but they are not directly exposed in the MDX language. Attributes actually map to levels (or properties) in MDX. I think the confusion comes about because, by default, an attribute generates a hierarchy with a single level in it that both have the same name as the underlying attribute. (I also think that some of this confusion comes about because of the way that SSAS coalesces different objects, but that is a topic for another time.)

So if you create a Month attribute in the Date dimension, when you process it will generate a Month Hierarchy and a Month Level so in the form <Dimension>.<Hierarchy>.<Level> you end up with [Date].[Month].[Month].

I think that understanding the different types of objects and how they interrelate if fundamental to being able to understand MDX.

In MDX terms:

  • a dimension contains a collection of 1 or more hierarchies,

  • a hierarchy contains a collection of 1 or more levels

  • and a level contains a collection of 1 or more members

...and there is no such thing as an attribute. :)

 

Update [17 Mar 09] - As Mosha has pointed out in the comments, MDX does not have a concept of dimensions either, just hierarchies. There are some references to dimensions, things like the .Dimension function (which actually returns a hierarchy and I think is just a hang over from AS 2000) and member unique names can be expressed in terms of [<dimension>].[<hierarchy>].[<level>].[<member>]. So I think that the dimension concept does "leak" into MDX a little bit.

Print | posted on Sunday, March 15, 2009 11:04 PM