Database Reference
In-Depth Information
However, we strongly recommend you always use unique names even if it means your
code ends up being much more verbose. This is because there may be situations where
Analysis Services takes a long time to resolve a name to a unique name; and there is
also the possibility that two members on different hierarchies will have the same name,
in which case you won't know which one Analysis Services is going to use.
Referencing cell values
A slightly more complex requirement that is often encountered is to be able to
reference not just another measure's value, but the value of another measure in
combination with other members on other hierarchies. For example, you might want
to create a calculated measure that always displays the sales for a particular country.
Here's how you can do this:
CREATE MEMBER CURRENTCUBE.Measures.[USA Sales Amount]
AS
([Measures].[Sales Amount], [Customer].[Country].&[United States]),
FORMAT_STRING = "#,#.##",
VISIBLE = 1 ;
The expression we've used here in our calculated measure definition consists of
a single tuple. In MDX, a tuple is a way of referencing the value of any cell in the
cube; the definition of a tuple consists of a comma-delimited list of unique names of
members from different hierarchies in the cube, surrounded by round brackets. In
the preceding example, our tuple fixes the value of the calculated measure to that of
the Sales Amount measure and the Customer Country United States.
The behavior of this new calculation can be easily seen when we browse the cube by
Customer Country:
 
Search WWH ::




Custom Search