Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Expression not working for Lastmonth value in qlik sense

Hi my Last month set expression is not working in Qlik sense.

I have Date fields in source file .from that i got month.

i have to show This month value and last month value in pivot table.

sum({<MonthP={$(=Max(MonthP)-1)},DateP=>}MonthlyActual)

Plz help me.it is urgent.

Thanks

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

sum({<MonthP={$(=Date(Date#(Month(Date#(MaxString(MonthP),'MMM'))-1,'M'),'MMM'))},DateP=>}MonthlyActual)

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Hi,

Some of your load statements have 'DD/MM/YYYY'  and some are with ' M/D/YYYY'

please check has this effecting your date format ?

Anonymous
Not applicable
Author

sum({<MonthP={'Nov'}>}MonthlyActual)

the above expression giving me result for last month when Dec month selected

but

sum({<MonthP={$(=Max(MonthP)-1)},DateP=>}MonthlyActual) giving 0

sasiparupudi1
Master III
Master III

sum({<MonthP={$(=Date(Date#(Month(Date#(MaxString(MonthP),'MMM'))-1,'M'),'MMM'))},DateP=>}MonthlyActual)

Anonymous
Not applicable
Author

Thanks Sasidhar

Silambarasan1306
Creator III
Creator III

Better u can generate monthID,

LET vDateMin='Your Date'

Num(Month($(vDateMin) + IterNo() - 1), '00')        as [Month (#)]
AutoNumber(Year & [Month (#)], 'MonthID')as MonthID


Then use this,

   monthid={$(=max(monthid)-1)}