Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team,
Request you to please help me create a flag in Qlikview Script that will show value =1 when Date is Last Month Date
I have created a flag but now not working because of change in Year from 2016 to 2017
if(Month(date(DateField))=month(today())-1,1,0) as isLastMonth...............This is not working
Similarly
For last previous 3 months I was using
if(Month(date(DateField))>=month(today())-3,1,0) as isLast3Month..This is also not working
Can anyone please help me create similar flag
Example
Say today date is 01/18/2017
DateField | IsLastMonth | IsPrevious3Month |
1/18/2017 | 0 | 0 |
12/19/2017 | 1 | 1 |
11/21/2016 | 0 | 1 |
10/24/2016 | 0 | 1 |
9/25/2016 | 0 | 1 |
Regards
Siddharth
May be like this:
If(MonthStart(DateField) = MonthStart(Today(), -1), 1, 0) as isLastMonth,
If(MonthStart(DateField) >= MonthStart(Today(), -3) and MonthStart(DateField) <= MonthStart(Today(), -1), 1, 0) as isLast3Month,
May be like this:
If(MonthStart(DateField) = MonthStart(Today(), -1), 1, 0) as isLastMonth,
If(MonthStart(DateField) >= MonthStart(Today(), -3) and MonthStart(DateField) <= MonthStart(Today(), -1), 1, 0) as isLast3Month,
Hi,
Try using AddMonth. See below description.
Addmonths function | Qlik Community
Best regards,
Cosmina
Load
DateField,
InMonth(DateField, Today(), -1) as IsLastMonth,
InMonth(DateField, Today(), - 3) as IsPrevious3Month
Thanks Sunny !!! It Worked
Thanks Cosmina !!!
Thanks Aurélien !!!