COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Debadarshan on 24 Feb 2012 08:09:35 AM

Title: I have to show 5 years in X-axis of a combination chart
Post by: Debadarshan on 24 Feb 2012 08:09:35 AM
I have to show 5 years in X-axis of a combination chart and I have 11 years starting from 2001. For example if I select the year as 2009 then 2009,2008,2007,2006,2005 should come in X-axis(i.e. year selected upto -4). What is the logic that can be written??
Title: Re: I have to show 5 years in X-axis of a combination chart
Post by: blom0344 on 24 Feb 2012 08:22:09 AM
Assuming the data contains a date item:

extract(year;[somedate]) >= ?parameter? - 4

possibly:

extract(year;[somedate]) >= cast(?parameter?,integer) - 4
Title: Re: I have to show 5 years in X-axis of a combination chart
Post by: Debadarshan on 27 Feb 2012 01:27:31 AM
But we have the year defined here. We don't need to extract the year out of a date. Then what can be done to display the year upto -4 years ?
Title: Re: I have to show 5 years in X-axis of a combination chart
Post by: blom0344 on 27 Feb 2012 06:48:52 AM
Are you kidding?  That would make it entirely trivial as you can simply subtract value 4 from either a year or parameter value:

[someyear] >= ?parameter? - 4

or:

[someyear] >=  cast(?parameter?,integer) - 4