Kulis
Kulis

Reputation: 1010

Refering to previous value in MDX

How I can refer to previous value of MDX measure? For example:

A   B
------
1   
2   1
3   2
4   3
8   4

It's look very simple, but when I use:

MEMBER [Measures].[B] AS(
    [Measures].[A].lead(1)
    )

It's gives me value of another measure (for example [Measures].[A2]), not last value from [Measures].[A].

Upvotes: 0

Views: 580

Answers (2)

user3426496
user3426496

Reputation: 125

You could try something like this:

MEMBER [Measures].[B] AS(
    [Measures].[A].CURRENTMEMBER.LAG(1)
    )

Upvotes: 1

whytheq
whytheq

Reputation: 35557

You need to use lag or lead against the members you have ON ROWS of the following:

A   B
------
1   
2   1
3   2
4   3
8   4

... well in the above there is nothing illustrated ON ROWS so it could be the following:

       A   B
       ------
1Jan   1   
2Jan   2   1
3Jan   3   2
4Jan   4   3
5Jan   8   4

So would apply lag or lead to the CURRENTMEMBER of the DATE dimension as it is ON ROWS

Upvotes: 1

Related Questions