Weighted average DAX help...

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,717
Hi Team,

Looking to replicate the following in DAX...

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

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]Key Figure[/TH]
[TH]UOM[/TH]
[TH]Month 1[/TH]
[TH]Month 2[/TH]
[TH]Month 3[/TH]
[TH]Month 4[/TH]
[TH]Month 5[/TH]
[TH]Month 6[/TH]
[TH]Month 7[/TH]
[TH]Month 8[/TH]
[TH]Month 9[/TH]
[TH]Month 10[/TH]
[TH]Month 11[/TH]
[TH]Month 12[/TH]
[TH]Average[/TH]
[/TR]
[TR]
[TD]Weight[/TD]
[TD]PUMs[/TD]
[TD]4,011,692[/TD]
[TD]4,186,301[/TD]
[TD]3,610,294[/TD]
[TD]3,413,225[/TD]
[TD]3,594,839[/TD]
[TD]3,684,366[/TD]
[TD]4,107,366[/TD]
[TD]3,765,739[/TD]
[TD]3,818,063[/TD]
[TD]3,691,572[/TD]
[TD]3,725,825[/TD]
[TD]3,204,528[/TD]
[TD]3,734,484[/TD]
[/TR]
[TR]
[TD]Value[/TD]
[TD]Days[/TD]
[TD]32.0[/TD]
[TD]32.8[/TD]
[TD]29.1[/TD]
[TD]27.3[/TD]
[TD]26.8[/TD]
[TD]27.6[/TD]
[TD]23.6[/TD]
[TD]21.6[/TD]
[TD]21.0[/TD]
[TD]22.8[/TD]
[TD]31.3[/TD]
[TD]29.3[/TD]
[TD]27.110[/TD]
[/TR]
</tbody>[/TABLE]

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

Code:
=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
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Usually weighted averages look like:

Code:
WAvg:=
DIVIDE (
    SUMX (
        VALUES ( Date[Months] )
        CALCULATE ( SUM ( Data[Value] ) * SUM ( Data [Weighting] ) )
    ),
    SUM ( Data[Weighting] )
)
 
Last edited:
Upvote 0
Hi Gaz,

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

Cheers,

Matty
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top