COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: NaviGator on 01 Mar 2009 08:01:47 AM

Title: Calculation based on Columns specified dynamically ..
Post by: NaviGator on 01 Mar 2009 08:01:47 AM
Hello Guys,

In my crosstab report, I put the the years at the columns. Then I added a filter to the report to select the required years insted of showing all years.

now if I am always going to select 2 years, I need to calculate the difference between the measure value in the selected years.

Suppose that I have selected 2008, 2006 then i need a third colum that gives me the value 2008-2006.

The problem I have is that the years are selected dynamically so i don't know how to create my calculated member because I will not be able to specify the required members.

Do you have any ideas ?

Thanks you for your support.
Title: Re: Calculation based on Columns specified dynamically ..
Post by: blom0344 on 02 Mar 2009 03:30:00 AM
Use 2 prompts (1 for startyear, 1 for endyear) and use the corresponding parameter values , ?startyear? and ?endyear? for use in your calculation definitions
Title: Re: Calculation based on Columns specified dynamically ..
Post by: Gollapudi on 02 Mar 2009 04:10:14 AM
Hi,

Just go through the attached report and try to concentrate on the hidden objects, hope this will help you.

Gollapudi.
Title: Re: Calculation based on Columns specified dynamically ..
Post by: NaviGator on 02 Mar 2009 04:51:10 AM
Hello blom ..

Thank you for your reply. Actually, this does not work for me. for some reasons, I can't use the paramater in my calculation definition.  It keeps give me strange error messages. Is this because I am trying to applying this on a DMR data ?

Thanks ..
Title: Re: Calculation based on Columns specified dynamically ..
Post by: NaviGator on 02 Mar 2009 04:54:57 AM
Hello Gallopudi,

Thanks a lot for your sample, Actually this is exactly what i am looking for. The problem is I am trying to do this with my dimensional data and it gives me errors like,

Invalid coercion from 'memberSet' to 'value' for 'member .....

Do you know what is the problem ? is it that i am using a DMR data? can we change the calculation to work with DMR data ?

Thanks a lot ..
Title: Re: Calculation based on Columns specified dynamically ..
Post by: Gollapudi on 02 Mar 2009 05:07:07 AM
Hi,

Try to use Data Items in your report [Like "Long Name" or "Short Name", mostly that will solve your problem.

Thanks,
Gollapudi.
Title: Re: Calculation based on Columns specified dynamically ..
Post by: NaviGator on 02 Mar 2009 05:14:44 AM
Thanks Gollapudi again. Could you please explain more ? How can I use Data items like this in my calculation ?

Thanks ..
Title: Re: Calculation based on Columns specified dynamically ..
Post by: Gollapudi on 02 Mar 2009 05:44:00 AM
Hi,

Using substring function you can avoid this error, just have a look at the attached report which is for the sample package Great outdoors Company which is a Dimentional model.


Thanks,
Gollapudi.
Title: Re: Calculation based on Columns specified dynamically ..
Post by: NaviGator on 04 Mar 2009 01:08:20 AM
Thanks a lot Gollapudi,

I am playing with the calculation and will update the topic here once I managed to do it.

Thanks again man.