Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

Thanks in advance

Chris

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

View solution in original post

6 Replies
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

Temp:

LOAD * INLINE [

    Asset, Live

    A, 66

    B, 75

];

Final:

LOAD *,

  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

Not applicable
Author

Wow, thank you very much it works perfectly

Not applicable
Author

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.

Thanks in advance.

Chris

Anonymous
Not applicable
Author

Hi Christian,

not exactly clear what you Need.

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

can you post sample?

Not applicable
Author

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.

Thanks for your help in advance.

Chris