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!

Calculaetd Measure Problem

Status
Not open for further replies.

Waynest

Programmer
Jun 22, 2000
321
GB
Hi

(Using MSAS 2005)

Please could somebody help me to understand what is wrong with the following calculated member definition (tried many variations of this now, always the same problem)

CREATE MEMBER CURRENTCUBE.[MEASURES].RatioVal

AS [Measures].[Val] / SUM(([Tbl Acc Codes].[Tbl Acc Lvl1].&[OUR],[Tbl Acc Codes].[Tbl Acc Lvl2].&[CORE],[Tbl Acc Codes].[Tbl Acc Lvl3 - Lvl 3 Code].&[INCOME]),[Measures].[Val]),

NON_EMPTY_BEHAVIOR = { [Val] },

VISIBLE = 1 ;

All I want is to show in cube browser alongside Measures.Val is another member called RatioVal.

RatioVal should be Val divided by the sum of Val with a lvl1 of 'OUR', a lvl2 of 'CORE' and a lvl3 of 'INCOME'

At the moment when I browse my cube I get a RatioVal subtotal for each lvl1, and each lvl2 but anything deeper into the hierarchy than that shows 1.#INF

Please give me any clues you can, I dont know if its the calculated measure itself or the way I have set up the cube, although everything else seems to work ok.

Thanks

 
I'm not so familiar with MSAS 2005 but it looks like you have a divide by zero error you could try the following:-

CREATE MEMBER CURRENTCUBE.[MEASURES].RatioVal

AS

iif(
SUM({[Tbl Acc Codes].[Tbl Acc Lvl1].&[OUR],[Tbl Acc Codes].[Tbl Acc Lvl2].&[CORE],[Tbl Acc Codes].[Tbl Acc Lvl3 - Lvl 3 Code].&[INCOME]},[Measures].[Val]) = 0
,
0
,
[Measures].[Val] / SUM({[Tbl Acc Codes].[Tbl Acc Lvl1].&[OUR],[Tbl Acc Codes].[Tbl Acc Lvl2].&[CORE],[Tbl Acc Codes].[Tbl Acc Lvl3 - Lvl 3 Code].&[INCOME]},[Measures].[Val])
),

NON_EMPTY_BEHAVIOR = { [Val] },

VISIBLE = 1 ;

Also member sets are usually bounded by {} rather than ()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top