Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good morning,
I am using the following expression as part of Set analysis to derive PT values for a month (it works)
Sum ({$<MonthExp={$(=Only(MonthExp))}>}PT)
When I try to deribe the prior month's values, I am using the following:
Sum ({$<MonthExp={$(=Only(MonthExp)-1)}>}PT) and instead of getting the previous month , i.e 'Mar' I am getting the value of 3 and not able to derive the prior month's values.
Please help.
Thank you
Value of 3? Can you may be share a screenshot or a sampl?
Hi,
create new variable to calculate previous month and use that in your set analysis.
Provide more details.
Kind Regards
Why does -1 not work?
May be this: ( I don't know your date format, So change accordingly...)
Sum ({$<MonthExp={$(=Only(Month(MonthExp)-1))}>}PT)
Hi,
Qlikview store data in dual datatype.
Whenever you perform arithmetic operation on date it convert it into number .
therefore you are getting 3 instead of mar.
Kind Regards,
Unfortunately this this did not work
With MonthExp = 'Apr' , the result was '0' instead of 'Mar'
I changed it to be:
Sum ({$<MonthExp={$(=Only(Month((MonthExp)-1)))}>}PT)
and instead of 'Mar' it returned 'Jan'
It looks like it's going back to the beginning of the quarter?
Can you please post a small sample app ....
Can you create a new field in the script and call it MonthNum
Num(Month(TempDate)) as MonthNum
and use this in your equation
Sum({$<MonthNum={$(=Only(MonthNum)-1)}>}PT)
Or completely get rid of Months because they are confusing and use dates instead:
Sum({<Date = {"$(='>=' & Date(MonthStart(Max(Date), -1), 'DateFieldFormatHere') & '<=' & Date(MonthEnd(Max(Date), -1), 'DateFieldFormatHere'))"}>} PT)