I want to write an mdx query with a calculated Measure. Here is my fact table:
How to implement a mesaure with the rule below :
If CurrentAtt != PreviousAtt then PreviousValue
else CurrentValue
Thank you so much!
any suggestion please ?
I want to write an mdx query with a calculated Measure. Here is my fact table:
How to implement a mesaure with the rule below :
If CurrentAtt != PreviousAtt then PreviousValue
else CurrentValue
Thank you so much!
any suggestion please ?
There are functions PrevMember
and MemberValue
in MDX
that you could use.
To implement the logic you could use IIF
So something like the following:
IIF(
[Attrib].CURRENTMEMBER.MemberValue <> [Attrib].CURRENTMEMBER.PREVMEMBER.MemberValue
, ([Attrib].CURRENTMEMBER.PREVMEMBER, [Mesure1])
, ([Attrib].CURRENTMEMBER, [Mesure1])
)