how to get geometric mean for a measure in cube in ssas 2012 -


i have 1 measure called stayinhospital in cube . want calculate geometric mean measure . please see example

day ,   accoutnumber , stayinhospital , visitcount  1   ,        a1      ,       2         ,   1 1   ,        a2      ,       4         ,   1 1   ,        a3      ,       8         ,   1 

geometric mean above example day 1 stayinhospital measure = (2*4*8)^1/3

                                                           =4 

i have done following calculation in calculated member

  measures.weightlog log(stayinhospital)   measures.productofweights 10^measures.weightlog   measures.gmlos (measures.productofweights)^(1/(measures.visitcount)) 

i not getting expected result.

it summing stayinhospital value instead of multiplying please .

calculated member formulas applied after aggregation. hence best solution calculate logarithm during data loading, e. g. named calculation in data source view, e. g. add calculation expression

log(stayinhospital) / log(10.0) 

assuming relational column named stayinhospital. expression takes care of fact log base e, not base 10, , converts logarithm of base 10.

then, define normal summable measure based on named calculation, named e. g. logstayinhospital.

finally, define measure gmlos as

( 10 ^ measures.logstayinhospital ) ^ (1 / measures.visitcount) 

or, equivalently, as

10 ^ (measures.logstayinhospital / measures.visitcount) 

if works fine, , not need debugging more, can make measure logstayinhospital invisible.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -