3 Replies Latest reply: Apr 20, 2012 7:02 PM by Stefan Wühl RSS

    Median based on Expression


         We have to calculate median based on expression. we have age values and we calculate vehicle distribution for each vehicle using the expression; sum(base wt)/ sum(toatl <vehicle> base wt). now we need to find the median age value. that is age value at which vehicle distribution crosses 50%. Any help regarding this is appreciated.

        • Median based on Expression
          Stefan Wühl

          You can probably work out an advanced aggregation expression, what is the context (dimensions) of your above expression? Could you post some sample data lines?


          An advanced aggregation could look like


          =median( aggr( sum([base wt])/sum(total<vehicle> [base wt]), vehicle))

            • Median based on Expression

              We have age as dimension. we need to calculate median age.


              sample data:

              Age    Distibution

              10          5%

              20          10%

              30          30%

              40          35%

              50          15%

              60            5%


              In this case, the median should be where the cumulative distribution crosses 50%.Here the median age will be 40.

              We need a single median age for every vehicle