I am facing some problem in calculating Median
I am trying to calculate the median value using one of the measures and a dimension value.
Time is a measure in my cube and OpId is one of the dimensions.The result is as follows:
opid time median
1 55
2 23
3 23
Total 23
The Time here for Op Id 1 is the aggregation for all the rows whose OpId is 1.I want the median of the values whose OpId is 1 which is not showing at the moment.
What I am getting here is the median for all of the OpId but what I really want is the median for each of the individual Opid's as well.
I am using a calculated field Median with the following expression.
MEDIAN
( [Dim Operation].[Dim Operation].currentmember.children ,[Measures].[Elapsed Time])
Thanks
I think the reason you're getting a null for the first three rows is that the .Children function won't return any members if you're at the leaf level already. Instead, you'll want to use the Descendants function. Something like the following should do the trick:
Median(
Descendants([Dim Operation].[Dim Operation].CurrentMember, ,LEAVES)
,[Measures].[Elapsed Time]
)
Now if you're expecting to calculate a median value for opid 1 for more than simply the opid 1 value, then you'll need to add another dimension to the equation.
No comments:
Post a Comment