COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: bonniehsueh on 13 Aug 2008 04:03:36 PM

Title: Missing value - Does it impact calculations?
Post by: bonniehsueh on 13 Aug 2008 04:03:36 PM
I'm trying to subtract two sets.  (Source: OLAP)

[Product Revenue] - [Cost of Goods Sold]
[Product Revenue] = 5000
[Cost of Goods Sold] = missing a value

I would think a missing value defaults to Zero, so when I take the difference, I expect to see 5000 (5000-0 = 5000) instead, I'm getting a missing value.

Has anyone seen a missing character impact a calculation?
Title: Re: Missing value - Does it impact calculations?
Post by: Gopinath on 14 Aug 2008 01:01:32 AM
Missing value defaults to Null so, try calculating it as

[Product Revenue] - if([Cost of Goods Sold] Is Null) then (0) else ([Cost of Goods Sold])
Title: Re: Missing value - Does it impact calculations?
Post by: bonniehsueh on 15 Aug 2008 10:59:38 PM
Yes, I hardcoded a number using a similar if statement as you did to force a value to be calculated and numbers showed up.

Thanks for your thoughts gobinath!
Title: Re: Missing value - Does it impact calculations?
Post by: blom0344 on 18 Aug 2008 04:40:23 AM
No need for an If construct. The Coalesce function is specifically aimed at doing what you need!