COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jcuiskelly on 26 Aug 2008 12:33:34 PM

Title: Adding columns when some values are null.
Post by: jcuiskelly on 26 Aug 2008 12:33:34 PM
Working in Report Studio, a List Report has five columns of data that needs to be added together.  Not all the columns will have a figure per row.  Using Query Calculation from the Insertabe Objects Toolbox, I do not know how to write the Expression Definition when nulls are involved.  How to you write the Expression for:

Column1 plus Column2 plus Column3 plus Column4 plus Column5 equals Query Calculation column?
100         +    100        +                +   100         +                 =     300

Thank you in advance.
Title: Re: Adding columns when some values are null.
Post by: blom0344 on 26 Aug 2008 12:40:48 PM

coalesce([some_item],0)
Title: Re: Adding columns when some values are null.
Post by: ssssss on 04 Sep 2008 09:00:14 PM
It seems now working in following statement

coalesce(percentage([some items]),0)

any ideas?

Thanks
Title: Re: Adding columns when some values are null.
Post by: blom0344 on 05 Sep 2008 08:29:47 AM
The idea is to transfer nulls to zero's BEFORE performing an arithmetic operation.
In your case it is the other way around..