Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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
hrlinder
Honored Contributor

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

6 Replies
hrlinder
Honored Contributor

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

ink12345
Contributor

Re: years and months

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

Re: years and months

Wow, thank you very much it works perfectly

Not applicable

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.

Thanks in advance.

Chris

hrlinder
Honored Contributor

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?

Not applicable

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.

Thanks for your help in advance.

Chris

Community Browser