Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jyotiranjan
New Contributor

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
Honored Contributor III

Re: Set Expression not working for Lastmonth value in qlik sense

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

5 Replies
galax_allu
Valued Contributor

Re: Set Expression not working for Lastmonth value in qlik sense

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 ?

jyotiranjan
New Contributor

Re: Set Expression not working for Lastmonth value in qlik sense

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
Honored Contributor III

Re: Set Expression not working for Lastmonth value in qlik sense

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

jyotiranjan
New Contributor

Re: Set Expression not working for Lastmonth value in qlik sense

Thanks Sasidhar

silambarasan130
Contributor II

Re: Set Expression not working for Lastmonth value in qlik sense

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)} 



Community Browser