开发者

How to get current row value in a WITH MEMBER calculation MDX?

开发者 https://www.devze.com 2023-03-26 20:35 出处:网络
I would like to calculate a Measure based o开发者_如何学Pythonn the current row. Problem is I can\'t find a way to get the current row in a WITH MEMBER part.

I would like to calculate a Measure based o开发者_如何学Pythonn the current row. Problem is I can't find a way to get the current row in a WITH MEMBER part.

WITH MEMBER [Measures].[Test] AS AVG(
    NonEmptyCrossJoin(
                FILTER(DESCENDANTS([Exigences].[ENVGR], [Levier], SELF),
                       [Exigences].CurrentMember.Name = 'Chemicals'),
                DESCENDANTS([Organization].[Valeo].[Powertrain Systems], [entity], SELF)),
    [Measures].[ProgressLevel])

SELECT {[Measures].[ProgressLevel], [Measures].[Test]} ON COLUMNS,
DESCENDANTS([Exigences].[ENVGR].[ENVGR-01.001], [Levier], SELF) ON
ROWS FROM [Exigences]

Chemicals is currently hard coded. That is for the example. I would like in place of 'Chemicals' to have the current rows value.

So let's say those are the values rows will return 'Chemicals', 'Pharmacy', 'Test', I would like the [Measures].[Test] calculation to change.

Can MDX do that ? If so how can I get the current value.

I tried [Levier].CurrentMember.Name but I think it's conflicting with the [Exigences].CurrentMember.Name.

Any one has an idea ?

Thank you,


This has been taking a bit of effort but that's the advantage to have a nice gold badge. We're using the MDX Generate function and named sets (myCellSet & 2d example in link) :

Not sure this is going to work for your provider but you can try this one :

WITH MEMBER [Measures].[Test] AS AVG(
 NonEmptyCrossJoin(
            Generate( {[Exigences].CurrentMember} as MyCellSet,
              FILTER(DESCENDANTS([Exigences].[ENVGR], [Levier], SELF),
                   [Exigences].CurrentMember.Name = MyCellSet.CurrentMember.Name)
            )
            ,
            DESCENDANTS([Organization].[Valeo].[Powertrain Systems], [entity], SELF)),
 [Measures].[ProgressLevel])
0

精彩评论

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