COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ccbarbeau on 25 Jul 2013 09:35:07 AM

Title: Using operators in If then Else statement for Absolute Values
Post by: ccbarbeau on 25 Jul 2013 09:35:07 AM
Good morning,

I have a table (DB2) which contains inventory transactions in absolute values. A 2nd column shows me with a S or an A whether it is a add or subtract transaction. I need to calculate the sum of the transactions for a given date/user. I was thinking of using an if then else but I'm not sure how to go about it.

Any suggestions?

Thanks!
Title: Re: Using operators in If then Else statement for Absolute Values
Post by: wyconian on 25 Jul 2013 09:54:35 AM
Hi

I'd suggest you need a column to decide what sign the values have, something like
IF (2nd Column = 'S')
THEN (Value *-1)
ELSE (Value)

Then you can do your totaling on this column.

Hope that helps
Title: Re: Using operators in If then Else statement for Absolute Values
Post by: ccbarbeau on 25 Jul 2013 10:24:27 AM
Thanks, that worked!