COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Nandini.t on 07 Dec 2011 02:26:12 AM

Title: Previous 5 years of selected year in prompt
Post by: Nandini.t on 07 Dec 2011 02:26:12 AM
Hi

I have a cross tab report with one of the prompt as accident year.
if i select the particular year in prompt i will get 'number of claims' and 'amount incurred' titled by selected analysis year.
but the required one is while running report what ever the accident year i specify based on that i should get output for previous 5 yrs .  The split over accident years is presented as 5 columns titled with the last five accident years from the analysis year.

pl help me out how can it be done.

   
Title: Re: Previous 5 years of selected year in prompt
Post by: pricter on 07 Dec 2011 02:37:39 AM
On what type of package the report is based  (cube or relational)?

Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 07 Dec 2011 02:41:53 AM
its relational
Title: Re: Previous 5 years of selected year in prompt
Post by: pricter on 07 Dec 2011 02:45:18 AM
Use the following filter

[Year] between (?Year?-5) and ?Year?
Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 07 Dec 2011 02:47:57 AM
i used the same before but data mismatch. getting same data for all years.
Title: Re: Previous 5 years of selected year in prompt
Post by: pricter on 07 Dec 2011 02:52:02 AM
How do you calculate your measures?
Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 07 Dec 2011 05:44:09 AM
measures are just addition of 2 data items thats it
Title: Re: Previous 5 years of selected year in prompt
Post by: Gyana.Sahoo on 09 Dec 2011 04:08:40 AM
Please try Rank function.

Rank(Year)<=5

It will shows the latest 5 year in the Prompt Query.
Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 13 Dec 2011 11:42:20 PM
no gyan, its actually one year must be selected in prompt so that in report output i should get data for previous 5 yrs along with selected year in the prompt.
hope u got it.
Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 14 Dec 2011 12:30:33 AM
if i use this condition   ([Year] between (?Year?-5) and ?Year?) 
iam able to see previous 5 yrs of data but all previous 5 yrs data is same so please guide me to overcome this.
Title: Re: Previous 5 years of selected year in prompt
Post by: HalfBloodPrince on 14 Dec 2011 12:43:47 AM
Try to test it by putting direct values like [Year]  between 2007 and 2010 and check if ur getting correct result or not. then you may find out the reason for mismatch.
Title: Re: Previous 5 years of selected year in prompt
Post by: Nandini.t on 14 Dec 2011 06:13:37 AM
thanks prince. :)

I checked individual years with all related conditions and traced out where the problem is and its working now.
Instead of using this  ([Year] between (?Year?-5) and ?Year?) 
i used
[Year] =?Year?
or [Year] =?Year?-1
or [Year] =?Year?-2
or [Year] =?Year?-3
or [Year] =?Year?-4
or [Year] =?Year?-5.

Actual problem was with some other related for statement in the report.