COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Erl072408 on 18 Dec 2012 10:31:03 AM

Title: calculations in cross tab
Post by: Erl072408 on 18 Dec 2012 10:31:03 AM
How can I get a difference column in my crosstab?

This is a simple report at this point, but I want to show the difference between the two years.  This is what the report looks like now.  It is adding the two years, but I want to show the difference between the two.

                                                      FY2012             FY2013

GL#105320100                          $29,947.15      $13,108.64        $43,055.79

Thank you
Title: Re: calculations in cross tab
Post by: MFGF on 18 Dec 2012 12:00:45 PM
Are you using a dimensional package or a relational package? If it's a dimensional package, simply add a query calculation with an expression that subtracts the FY2012 member from the FY2013 member. For a relational package, you will need to get rather more clever. You will need separate calcs for each FY with an expression such as

if ([Year item] = 'FY2012') then ([Your measure value]) else (0)

if ([Year item] = 'FY2013') then ([Your measure value]) else (0)

Then subtract one from the other in your difference calculation

Cheers!

MF.
Title: Re: calculations in cross tab
Post by: Erl072408 on 18 Dec 2012 01:31:14 PM
Thank you for the reply, however there is a prompt page which prompts the user to pick more than one fiscal year.  So I think I would have to create quite a few if statements.

This seems like it would be an easy one.  The last column is produced automatically as addition.  Seems to me that I could just change the math.... :'(
Title: Re: calculations in cross tab
Post by: blom0344 on 19 Dec 2012 06:09:45 AM
This is not a matter of 'simply' changing the math. Summarizing data can be a standard function as it involves selecting a single range to work upon.  Calculating a difference requires input of 2 values, which requires writing an expression as pointed out..

You can define a more generic calculation if you use the 'year' input parameter to work against