Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Either a MDX statement or a IIF statement required 1

Status
Not open for further replies.

eo

MIS
Apr 3, 2003
809
Hi,

I have MDX which calculates a "Loss Ratio". But the divider is often null, in fact, all three components could be null, which then deliveres a "-1.#IND" result. I would prefer a NULL result rather. Can someone show me how to amed the MDX using either CASE or IIF (or anything else more appropriate) to do this?

Code:
CREATE MEMBER CURRENTCUBE.[MEASURES].[ClmGrsIncLR%]
 AS 100*([Measures].[ClmGrsIncIndem]+[Measures].[ClmGrsIncFee])/[Measures].[PrmGGAcc], 
FORMAT_STRING = "0.0", 
VISIBLE = 1;

EO
Hertfordshire, England
 
try this

Code:
CREATE MEMBER CURRENTCUBE.[MEASURES].[ClmGrsIncLR%]
 AS 
IIF(
	IsEmpty([Measures].[PrmGGAcc]),
	Null,
	100*([Measures].[ClmGrsIncIndem]+[Measures].[ClmGrsIncFee])/[Measures].[PrmGGAcc]
), 
FORMAT_STRING = "0.0", 
VISIBLE = 1;

Paul
---------------------------------------
Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
The NULL still gave the same result, but replacing that with =0 gave me what I want...I read somewhere that =0 is like NULL in MDX??
Code:
CREATE MEMBER CURRENTCUBE.[MEASURES].[ClmGrsIncLR%]
 AS 
IIF(
    [Measures].[PrmGGAcc]=0,
    Null,
    100*([Measures].[ClmGrsIncIndem]+[Measures].[ClmGrsIncFee])/[Measures].[PrmGGAcc]
), 
FORMAT_STRING = "0.0", 
VISIBLE = 1;

Thanks for this!!

EO
Hertfordshire, England
 
Sorry, it was not the NULL, but rather the IsEmpty

EO
Hertfordshire, England
 
Null and 0 get treated seperately I always make it a practice of doing a double check

Code:
IIF(Isempty(val),0,IIF(val = 0, Val+val,0))

Paul
---------------------------------------
Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top