Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
stuwannop
Partner - Creator III
Partner - Creator III

Dates Falling in last 3 months

Hi Everyone

Hope you can help me with a bit of script.

I currently have a line in my calendar script that that will return a 1 if the date loaded falls in the last calendar month. The line is:

IF(InMonthToDate(Date, today(), -1),1,0)

I am trying now to write the same script line but this time to return a 1 if the date falls in the last THREE calendar month - not including the current month.

I've played around with multiple if but I can't quite crack it - can anyone help?

Thanks

Stu

1 Solution

Accepted Solutions
daveamz
Partner - Creator III
Partner - Creator III

Hi Stu,

Try

If(Date>=MonthStart(AddMonths(Today(),-3)) AND Date<MonthStart(Today()),1,0) as InLast3Months

Best regards,

David

View solution in original post

2 Replies
daveamz
Partner - Creator III
Partner - Creator III

Hi Stu,

Try

If(Date>=MonthStart(AddMonths(Today(),-3)) AND Date<MonthStart(Today()),1,0) as InLast3Months

Best regards,

David

stuwannop
Partner - Creator III
Partner - Creator III
Author

That's superb David - thanks for your help and the quick response.

Stu