I have started working with QS recently and I have a problem with defining an expression which will allow me to display previous month's data.
I have tried creating previous month variable:
vPreviousMonth = MonthName(Addmonths(Max([Calendar Termination Month]),-1))
however this did not work - retrieves value 0. Then I tried below:
If(MonthStart([Calendar Termination Month])=MonthStart(Today()),-1,0) as PreviousMonth
which doesn't work either - retrieves current month's values, used in below expression:
sum({<PreviousMonth={"-1"}>} [Terminated])
.
Lastly, I tried
sum({$<[Calendar Termination Month]={"$(=[Calendar Termination Month](AddMonths(Max(Date),-1),'YYYY-MM'))"}>}[Terminated])
which, surprise!, retrieved 0 value as well.
Is there any way I can somehow make this work?
Try this