
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Difference in Months, between 2 dates
hi all
I want to calculate, the difference in months between today() and a CommencementDate in Qlik (true qlik date, format DD/MM/YY)
My statement is "'mm'".
if CommencementDate = 12/02/2015, I get 3021120. Obviously thats not right.
if I change the 'mm' to 'M' or 'MM' i get zero....
what am I doing wrong here?
Thanks
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,I think there is no function to calculate months difference, and interval() function anly allows for days, not months, I would try with something like: =(Age(Today(),CommencementDate)*12)+(Month(Today())-Month(CommencementDate))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,I think there is no function to calculate months difference, and interval() function anly allows for days, not months, I would try with something like: =(Age(Today(),CommencementDate)*12)+(Month(Today())-Month(CommencementDate))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've just stumbled on round((interval#(Today()-CommencementDate, 'DD')/30.5)) and that seems to work ok.
Thank you very much.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you handle A Zero value for Age. From day 1 to day 365/366 is year 0 and anything multipleid by that is 0
Example: Age('12/31/2021', '1/1/2021') = 0 and 0 * 12 = 0 where you would really want 1 i.e. 12 if you are looking for months
However
Age('12/31/2021', '1/1/2020') = 2,
Also if you are wanting something like 3 months as a time interval this does not work and dividing by 365 will not always work because of leap years.
Sounds like a DateDiff function should be added just for this purpose so you can specify that you want the interval in Days, Months, Years.
