Forum Discussion

curtismob's avatar
curtismob
Helper IV
3 years ago
Solved

Variance From Average

Hello.

I am trying to find the variance of a measure (SUM), from an average measure of the sum.  Below is some simple data.

ProductAreaCost
Product1Area 110
Product1Area 215
Product1Area 320
Product2Area 120
Product2Area 225
Product2Area 330
Product3Area 130
Product3Area 235
Product3Area 340

 

The SUM measure may be CostSum = SUM(Table[Cost])

 

Desired matrix result:

 Area 1 CostAvgVarianceArea 2 CostAvgVarianceArea 3 CostAvgVariance
Product11015-51515020155
Product22025-52525030255
Product33035-53535040355

 

I hope this data is simple enough to copy and paste to Excel/csv and import into a pbix.  The main challenge is having the product average be the same, for each area in the row.

 

Thank you in advance,

curtismob 

  • Hi,

    Write these measures

    C = SUM(Data[Cost])
    Average product cost = AVERAGEX(ALL(Data[Area]),[C])
    Variance = [C]-[Average product cost]

    Hope this helps.

4 Replies

  • I apologize, below is a better representation of the desired result.

     

     

  • Hi,

    Write these measures

    C = SUM(Data[Cost])
    Average product cost = AVERAGEX(ALL(Data[Area]),[C])
    Variance = [C]-[Average product cost]

    Hope this helps.

    • curtismob's avatar
      curtismob
      Helper IV

      Hi Ashish,  I am reviewing your solution and trying to test it with some actual data.  As you would expect, my actual data, with a couple of relationships involved, is not as simple as my example data for this post.  Your solution has given me some good direction.

       

      Thank you for the quick response,

      curtismob