New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor

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.

Lorenzo

4 Replies
Not applicable

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

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.

Esteemed Contributor II

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

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

Not applicable

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

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

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

New Contributor

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

Thank you very much to everybody!!!

All your suggestion are right and the KPI is working!

Thanks again!

Lorenzo