Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Formula for difference between two dates in months

Hi

I'm trying to create a formula that will tell me the difference between a start date in whole months.

e.g.  Start Date 15/07/12, End Date 2/12/13

This should result in 18 months, as regardless of the day it starts/finishes, the whole month counts as one, i.e. a Start date of the 1st is treated the same as if it were the 31st.

I've tried using interval but it doesn't seem to come out with the results I want.  Does anyone have any suggestions?

Thanks

Steve

1 Solution

Accepted Solutions
Not applicable
Author

(Year(enddate)-Year(startdate))*12+13-month(startdate)-(12-month(enddate))

View solution in original post

4 Replies
Not applicable
Author

(Year(enddate)-Year(startdate))*12+13-month(startdate)-(12-month(enddate))

Gysbert_Wassenaar

See this discussion: How Do I Get the Number of Months Between Two Dates?


talk is cheap, supply exceeds demand
Not applicable
Author

Hmmm, I'm a little annoyed with myself for not coming up with this on my own.  I think I was over complicating matters when a simple formula would do what I want.

Many thanks for spotting this and helping me out.


Steve

Not applicable
Author

No worries, that's what this forum is for!