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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Fig1
Contributor III
Contributor III

Stop rounding in month formula

I have a formula in my script to calculate the number of months between [field_start_date] and the reload date.  The issue is that is rounding up to the next month.  EG. 11.2 months between two dates is rounding this to 12.  How can I stop the rounding??

Formula:

((year(reloadtime())*12)+month(reloadtime())) - (((year(field_start_date)*12)+month(field_start_date) as Number_Months,

 

Please help! Thanks.

2 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Can you give an example, which dates are you using to get the 11.2 months?

sunny_talwar

So, if you don't want to see 12 months, would you rather see 11 months or are you looking to see 11.2 months? Right now the way you expression is written, it is giving you difference between two dates in months. It can give you 12 (like it is) or 11 (by subtracting 1 from it)... but to get .2 will be tricky because for .2 I am assuming you have 6 days, but then do you divide this by 30 or 31 or even 29/28 for Feb? How do you determine the number of days in a month? or you can say 11 months and 6 days?