COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: naveen10046 on 09 Nov 2010 11:52:37 PM

Title: Need to show 12 months rolling date
Post by: naveen10046 on 09 Nov 2010 11:52:37 PM
I have an item called "Resolution date" in my package, which is the only available date data item.

Now I need to show up the tickets for 12months
such as

march/2009aprl/2009may/2009.....feb/2010

Please help me to figure out how is it possible?

Thanks is advance
NaviN
Title: Re: Need to show 12 months rolling date
Post by: blom0344 on 10 Nov 2010 04:01:41 AM
The most important function for you is the _add_months Cognos function combined with _last_of_month

Example:

_add_months(_last_of_month(current_date),-1)  yields  30 october.

Create a bucket 'Month-1' for - in this case- october:


CASE WHEN
[resolution_date] between
_add_months(_first_of_month(current_date),-1)
and
_add_months(_last_of_month(current_date),-1)
THEN [somevalue]
ELSE (0)
END