6 Replies Latest reply: Nov 9, 2015 1:55 AM by Christian Wylezol

# years and months

Hi

I have a "little" issue. We are doing some asset accounting with qlikview.

Now I have a asset with Rest-useful live of 66 Month.

How can I reach, that not 66 month, but '5 years, 6 month' will be shown?

I tried several things but nothing worked.

Maybe someone has a solution for me.

Chris

• ###### Re: years and months

use formula

=div(yourresult,12) & ' years' & mod(yourresult,12) & ' month'

not sure where you Need it; as Expression or as dimension

as Expression you may use dual function

• ###### Re: years and months

Wow, thank you very much it works perfectly

• ###### Re: years and months

Hi Rudolf,

I have a Little additional issue.

Can you tell how to Show only the years, when I have Zero additional months?

i.e.: I have 36 Month - with your Expression only "3 years" without  the months-section will be shown.

Chris

• ###### Re: years and months

Hi Christian,

not exactly clear what you Need.

You have 36 months . WEHat do you mean with Zero additional months?

can you post sample?

• ###### Re: years and months

Good Morning Rudolf,

here is my example. I have a "ND" of 2 Years and 0 Months.

In this Case (when the months are zero) only the the years should appear.

Chris

• ###### Re: years and months

Temp:

Asset, Live

A, 66

B, 75

];

Final:

div(Live,12) & chr(32) &  'Years' & ',' & chr(32)& Mod(Live,12) &chr(32) & 'Month' as MonthYear

Resident Temp;

DROP Table Temp;

Hope this example helps.

Regards,

Imran K