Calculated Cell - based on a condition of the same measure -
06-02-2004
, 09:34 AM
Some of the measures are reported as 0 in my database. But I want to
show NULL.
Here is the solution I found:
I created two base measures in my cube (based on exactly the same fact
table columns)
Sale0 : "Fact_Table"."Sale"
Sale : "Fact_Table"."Sale"
Sale 0 is a hidden measure.
Then I created a calculated cell:
Converting 0 to NULL
Calculation Subcube: {[Measures].[Sale]}
Calculation Value : iif([Measures].[Sale0] = 0,
NULL,[Measures].[Sale0])
Practically speaking, [Sale] is just a placeholder. But this seems
cumbersome. Is there a better way to do this? (Like not having to
create two measures instead of one). When I tried it... it was giving
me "infinite recursion" error. Maybe better MDX needs to be written.
In other words:
Converting 0 to NULL
Calculation Subcube: {[Measures].[Sale]}
Calculation Value : iif([Measures].[Sale] = 0,
NULL,[Measures].[Sale])
Now this would work if it were a calculated member. But I'd like to
use the calculated cell. (So that I can use nonemptycrossjoin on my
base measures)
I would appreciate your answer. |