Default Measure in SSAS Cubes

When writing MDX it is always a good idea to know what the context which the query executes in is. If we do not explicitly specify a hierarchy member in a tuple SSAS replaces it with the default one, which way more often than not is the All member for dimensions. Because the All member is the default default member, it is easy to think that the default is always the All. This is untrue – the default can be easily changed through BIDS. A sinister (not really, but the word is cool) consequence of this is very apparent when we consider the Measure dimension.

Measures are in a dimension of sorts. It does not have an All member, so we can say it is non-aggregatable; however it has a default member, which is used whenever we do not explicitly specify a [Measures].[<member>] to be used. The most confusing part is when we omit the Measures member in a function call, and a prime example is the NonEmpty() function call which goes like this:

NonEmpty(<set>,<set>) -> NonEmpty([Customer].[Customer].[Customer], [Date].[Calendar].[CY 2007])

What we get here is a slight problem. NonEmpty still uses a measure – that is the default measure. And if we are not careful, we end up getting incorrect, or even invalid results (e.g. if the default measure is not related to one of the dimensions we may get the set of all members from the first set). However, if we do:

NonEmpty([Customer].[Customer].[Customer], ([Date].[Calendar].[CY 2007], [Measures].[Internet Sales Amount]))

We will get exactly what we want – the function uses the correct, or at least a known measure.

Often we do not know what is the default Measure member. To find it out we can just write this little query:

MEMBER [Measures].[dMemberName] AS
} ON 0
FROM [Adventure Works]

The result is the default Measure member name.


One thought on “Default Measure in SSAS Cubes”

  1. Boyan,

    Thanks for this article, it helped me with my Set Focus BI Project. I have no idea how BIDS set the default Measure to Hours in my project. I was getting 33390 of something and had no idea what it was with SELECT FROM [CubeName] so Googled default measure, found your article thereby.

    OK, how does one set a default measure? How is it that BIDS picks one? I’m sure it has to pick one and somehow the Fact Table with Hours in it was somehow set in order to avoid an MDX error.

    Thanks in advance for your help.


Comments are closed.