Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pauledrich
Contributor

Static 'to' Date

Thanks in advance for your help on this topic...

My objective is to create a script entry to calculate from historical dates to a set period in time which in this instance is static 31/3/2014.

My script currently calculates the historical date to today to give me a 'MonthsAgo' amount like:-

12*Year(today()) - year("HistoricDate")) + Month(Today()) - Month("HistoricDate")  as  MonthsAgo

I have tried multiple combinations of the above replacing Year(today()) with '31/3/2014' which isn't returning the desired result.

Any ideas where I am going wrong?

Regards

P

Tags (3)
1 Solution

Accepted Solutions
Not applicable

Re: Static 'to' Date

Maybe:

12*(2014 - year("HistoricDate")) + 3 - num(Month("HistoricDate"))  as  MonthsAgo

reg

D

2 Replies
Not applicable

Re: Static 'to' Date

Maybe:

12*(2014 - year("HistoricDate")) + 3 - num(Month("HistoricDate"))  as  MonthsAgo

reg

D

pauledrich
Contributor

Re: Static 'to' Date

Thank You - works perfectly and logical.

Community Browser