# Weighted average DAX help...



## Matty (Apr 18, 2018)

Hi Team,

Looking to replicate the following in DAX...

Here's an example table in Excel to paint the picture:


Key FigureUOMMonth 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11Month 12AverageWeightPUMs4,011,6924,186,3013,610,2943,413,2253,594,8393,684,3664,107,3663,765,7393,818,0633,691,5723,725,8253,204,5283,734,484ValueDays32.032.829.127.326.827.623.621.621.022.831.329.327.110

<tbody>

</tbody>
I would like to calculate the weighted average value seen in cell O3, which was achieved in Excel using the following:


```
=AVERAGE(C3:N3*C2:N2)/AVERAGE(C2:N2)
```

Array entered.

Hope someone can assist.  I've been playing around for a while and can't quite get it.

Thanks,

Matty


----------



## gazpage (Apr 18, 2018)

Usually weighted averages look like:


```
WAvg:=
DIVIDE (
    SUMX (
        VALUES ( Date[Months] )
        CALCULATE ( SUM ( Data[Value] ) * SUM ( Data [Weighting] ) )
    ),
    SUM ( Data[Weighting] )
)
```


----------



## Matty (Apr 21, 2018)

Hi Gaz,

Thanks for that.  I managed to get something to work based on this.

Cheers,

Matty


----------

