开发者

MDX Calculated member Sum of selected members rollup

I'm trying to write a calculated member that will roll up along a dimension based on the selected values provided on the axes.

Product -> subcategory -> category lexus -> sedan -> car lexus-coupe -> coupe -> car bmw -> sedan -> car bmw-coupe -> couple -> car ford -> pickup -> truck chev -> pickup -> truck ford-suv -> suv -> truck lincoln-nav -> suv -> truck

[Calculated measure] = [measures].[a]+[measures].[b]

suppose the user wants to see [Calculated measure] at the c开发者_运维知识库ar level for just lexus-coupe and bmw. How do you create a calculated measure that will roll up at the car level based on what has been selected in the dimension?

Thank you in advance!


I have previously written MDX to check what dimensions are being used on rows (or columns) and change the way a measure is being calculated. It is a bit messy.

This example looks to see if axis 1 (rows?) is using any Measures, and can change the calculation accordingly:

IIF(InStr(1, SetToStr(StrToSet("Axis(1)")), "[Measures].") = 0, blah, blah)

Can't remember why I did StrToSet and then SetToStr, but it worked!

You may be able to use VBA string functions like InStr() to examine what the user has selected on rows and columns, and fiddle with your calculated members accordingly...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜