all groups > sql server data warehouse > april 2004 >
You're in the

sql server data warehouse

group:

Calculations involving NULLs


Calculations involving NULLs Jeremy McMahan
4/16/2004 12:56:12 PM
sql server data warehouse:
I have a Calulated Member that is calculating an average.

[Measures].[Overall Satisfaction]/[Measures].[Count Of Survey]

The problem is that for some of the items there are no surveys, so there are
NULL values in the database for these.

When I view the cube as a pivot table in Excel I am getting #NUM! for any
dimentions that do not have actual numbers.

How can I change my calculation so it will just return NULL instead of the
dreaded #NUM! value that drives managers so crazy?

Thank you!


:-J
Jeremy

Re: Calculations involving NULLs Anith Sen
4/16/2004 5:10:30 PM
Use COALESCE or ISNULL function to change a NULL to a valid value or a
space.

--
Anith

RE: Calculations involving NULLs Agustin Brau
4/20/2004 5:36:05 AM
REGARDS MY EXAMPL
-------
[Measures].[Average] AS ' IIF(ISNULL([Measures].[Count Of Survey]), NULL, [Measures].[Overall Satisfaction]/[Measures].[Count Of Survey])
-------
You colud use ISNULL() with a tuple, for example ISNULL(([Time].[2004].CURRENTMEMBER, [Measures].[Overall Sastisfaction)
I hope it would help yo
Re: Calculations involving NULLs Jeremy McMahan
4/23/2004 3:25:22 PM
Thank you for the help it got me going on the right track.

What I ended up with was:

IIF([Measures].[Count Of Survey]=0, NULL, [Measures].[Overall
Satisfaction]/[Measures].[Count Of Survey])

This seems to work perfectly!

Thanks agian!

-Jeremy


[quoted text, click to view]

AddThis Social Bookmark Button