Forum Discussion

nok's avatar
nok
Advocate II
1 year ago
Solved

Calculate average variance

Hello! Please note that all the columns and measures used in my report come from the same table, called "MyTable". So... I created a measure that calculates the price variance of the Items in my tab...
  • lbendlin's avatar
    lbendlin
    1 year ago

    I think we have different understanding of what Variance means.

     

    Variance is the expected value of the squared variation of a random variable from its mean value, in probability and statistics.  Informally, variance estimates how far a set of numbers (random) are spread out from their mean value.

    The value of variance is equal to the square of standard deviation.

     

    Based on your sample data here is the variance of the individual groups

     

     

    If you want the average of the variance then you need to "Think like the Grand Total"  and materialize the variances for all groups.

     

     

    variance = 
    var a = ADDCOLUMNS(SUMMARIZECOLUMNS(MyTable[ID       ],MyTable[Item        ]),"v",CALCULATE(var.p(MyTable[Price])))
    return AVERAGEX(a,[v])