Weighted Averages in PivotTables, Excluding Values Not Available

etsang

New Member
Joined
Mar 15, 2016
Messages
1
Hi, I'm just starting to use PowerPivot and would like to know how to account for values not available when calculating a weighted average.
My data is structured similar to the below
[TABLE="width: 192"]
<colgroup><col span="3" width="64" style="width: 48pt;"></colgroup><tbody style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; margin: 0px; outline: 0px; padding: 0px;">[TR]
[TD="width: 64"]weights[/TD]
[TD="width: 64"]values1[/TD]
[TD="width: 64"]values2[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]3.4[/TD]
[TD="align: right"]5.8[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]2.1[/TD]
[TD="align: right"]6.7[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]1.2[/TD]
[TD="align: right"]7.1[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]1.8[/TD]
[TD="align: center"]#N/A[/TD]
[/TR]
[TR]
[TD="align: right"]50[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]6.6[/TD]
[/TR]
</tbody>[/TABLE]
Right now, I have a few DAX formulas built to create weighted average fields for my pivot table.
(1) TotalWeights = sum([weights])
(2) WtdAvgValues1 = sumx(Table1, [values1] * [weights]) / [TotalWeights]
(2) WtdAvgValues2 = sumx(Table1, [values2] * [weights]) / [TotalWeights]

What I'd like PowerPivot to do is exclude the #N/A in value2 when calculating the weighted average (i.e. excluding the #N/A value from the sumproduct numerator and removing the "10" from the sum of the weights).
But of course, PowerPivot is unable to read the column with the #N/A.
Anyone have suggestions on what is the best way to create weighted averages that would account for missing values?
Thanks in advance!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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