COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jd on 09 Dec 2009 08:32:08 AM

Title: How can I create a year calculation based on my date received data item
Post by: jd on 09 Dec 2009 08:32:08 AM
Hello,

I have quesiton, how can I create a year calculation based on my date received data item?

Title: Re: How can I create a year calculation based on my date received data item
Post by: lostmytoy on 09 Dec 2009 09:01:57 AM
Add a year column in the list and group by that column.
Title: Re: How can I create a year calculation based on my date received data item
Post by: Sreeni P on 09 Dec 2009 11:45:34 AM
leave ur question more specifically, so that we can have an idea about the problem..

according to my level of knowledge, that you have one 'Date' data item , which gives a core Date value...which means (13 feb 2009) like that...wasn't it? any ways if u want to convert this into Years ...first you need to compare it on the current date...
means .....total no of days(years)= current date - previous date(i.e, the dataitem value).

here you can use these two functions to get the difference between dates

1. -age(date_exp)
     
     ex:Today's date=2003-02-05 _age ( 1990-04-30 )
     Result: 120906 that is 12 years, 9 months and 6 days

2._ymdint_between ( date_exp1, date_exp2 )

    _ymdint_between ( 1990-04-30 , 2003-02-05 )
    Result: 120906 that is 12 years, 9 months and 6 days

Here you can use the 'date_exp1' variable as your parameter value(prompt)