tags:

views:

121

answers:

2

This is a pretty straight forward question that may or may not be possible but, when you create a measure in a SSAS 2005 cube, there is a description property which can be set, which we've been using in the client application that consumes the cube.

Is it possible to set this description when you create a calculated member through MDX? i.e. something like (although it doesn't work as I get an error saying the syntax near DESCRIPTION is incorrect)

CREATE MEMBER CURRENTCUBE.[Measures].[CalculatedMember] AS
NULL,
FORMAT_STRING = "Percent",
VISIBLE = 1,
DESCRIPTION = "My favourite calcuated measure";
A: 

http://msdn.microsoft.com/en-us/library/ms144787.aspx

The property you are looking for is CAPTION:

CREATE MEMBER CURRENTCUBE.MEASURES.[Test Measure] 
 AS 1, 
CAPTION = 'My testing measure'; 
Meff
Thanks for the response but it looks like the CAPTION property is not available in 2005, only 2008.
Dan Kennedy
+1  A: 

As in SSAS 2005 there isn't the CAPTION property, if you must have a caption I could suggest a workaround to try:

Create the member you want, name it as you want and give it the description you want. It doesn't matter what you base it on, but get it as close to the actual desired output as you can.

So, if you create [Measures].[Test] in the cube designer, with "Test Measure" as the description, then you can use SCOPE to overwrite the cell contents with your own calculation at evaluation time:

SCOPE([Measures].[Test]);
 THIS = [Measures].[A] + [Measures].[B];
END SCOPE;

So copy and paste the above into your calculations tab in SSAS designer, note that you will have to go into script view as opposed to form view.

Hopefully you will now have a measure that performs as you want, with the caption that you want. Figuring out the non-empty and getting that all correct may be another story...

Meff
Meff,Again, thanks for the post but this doesn't achieve what we need. Basically the problem is the description of a measure is being used in the client app to provide a tooltip for the measure. what you've described here will create me another measure with the value of two other measures combined, leaving the other as it was. I think I've come to the conclusion that it's simply not possible and will have to look at a place to store the measure metadata outside the cube itself.
Dan Kennedy
@Dan-Kennedy The SCOPE statement allows you to redefine the measure as it is evaluated - You create a measure with the correct description (MetaData) in the designer as normal then use your own calculation to redefine what the output should be.The example above was just an example of syntax, I believe you can achieve what you want, and I believe my approach will work, if I haven't explained it properly do just give it a try.In my example above, the "[Measures].[A] + [Measures].[B];" should be replaced with your real MDX, then you have both calculation and description?
Meff