0

I want to write an mdx query with a calculated Measure. Here is my fact table:

my case

How to implement a mesaure with the rule below :

If CurrentAtt != PreviousAtt then PreviousValue

else CurrentValue

Thank you so much!

any suggestion please ?

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • Hi Tarikqazza - I think people will help you but you need to first have a go at creating MDX query yourself and then post your attempt in here – whytheq Jun 04 '23 at 12:38

1 Answers1

0

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])
)
whytheq
  • 34,466
  • 65
  • 172
  • 267