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: 
Anonymous
Not applicable

Payback From Number of Months to N. of Years and N. of Months

Good Morning,

I would ask you which is the right way to transform a certain amount of Months (this is a Payback period expressed in Months) in the same amount expressed in Year and Months.

For example 52 Months =  4 years and 4 months.  

It is a silly thing but I don't know how I can do it.

Thanks in advance for your support

Lorenzo

4 Replies
Not applicable
Author

Hi Lorenzo,

Not sure how exactly you are wanting to represent the years and months.  If you are wanting to break down to a year field and month field the below will work, you can then combine back if needed.

If 'Payback' is the field name of your number of months.

Calculate Years    = floor(Payback/12)

Calculate Months = Payback- floor(Payback/12)*12

Hope that makes sense and is helpful.

Adrian

vinieme12
Champion III
Champion III

Floor((52/12))&' Years and ' &  mod(52,12)&' months'

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

I think round will not work use floor in that place.

floor((52/12))&' Years and ' &  mod(52,12)&' months'

Anonymous
Not applicable
Author

Thank you very much to everybody!!!

All your suggestion are right and the KPI is working!

Thanks again!

Lorenzo