AVERAGE X proper SubTotal

PaulGotts

New Member
Joined
Nov 5, 2012
Messages
29
I have been struggling for a few days trying to get the correct Average to show up in my Pivot table's subtotal.

I was unable to make it work with Calculated Fields but by creating a Calculated Column and doing my first calculation inside of it, I was then able to calculate my average field across a many to many relationship by using the average formula inside my first Calculate of the M2M Calculated Field.

FacingsCC:=SUMX(FILTER(Facings,AND(Facings[Div-Str]=SalesData[Div-Str],Facings[UPC]=SalesData[UPC])),Facings[Facings])

This first formula brought the denominator into the Calculated column of the Table I wanted to operate in.

UpFCC:=SalesData[SCANNED_MOVEMENT_CUR]/SalesData[FacingsCC]

This second formula conducted a simple division into another Calculated Column to see how many sales of each product in each store there were per facing of said product in said store.

AvgX:=CALCULATE(AVERAGE(SalesData[UpFCC]),FILTER(SKUsM6,CALCULATE(COUNTROWS(Facings))>0),FILTER(StoresM6,CALCULATE(COUNTROWS(Facings))>0))

Finally, this formula as a Calculated Field obtained the Average of the units sold per facing as per the filter contexts in the Pivot Table... i.e. it returns the proper average for both individual products and multiple products (store level).

Don't know if this will help anyone but I did find several people suggesting it was not possible. My assumptions are that it is not possible without doing some ETL (basically, a fancy name for manually manipulating the data in your model).

I am 1 week new to PivotTables, go easy on me.

Paul.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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