Calculated field question sum of a product rather then the product of sums -
07-26-2006
, 11:14 AM
Here is my calculated field. I want to sum the "effective
duration" * "portfolio weight" but what I get back is the sum of
the "effective duration" * sum of "portfolio weight".
How would I write that code or should I do that calculation when I am
importing the data into the fact table.
CREATE MEMBER CURRENTCUBE.[MEASURES].[Weighted Duration]
AS Case
When IsEmpty
(
[Measures].[Effective Duration]
)
Then Null
When IsEmpty
(
[Measures].[Portfolio Weight]
)
Then Null
Else (
[Measures].[Effective Duration] * [Measures].[Portfolio Weight]
)
End,
FORMAT_STRING = "#,#.0000",
VISIBLE = 1 ; |