Average Calculated Fields

seancsn

New Member
Joined
Feb 12, 2015
Messages
18
I have a table in Powerpivot with columns: Country, County, Town, Product name, Sales, number of Products sold.

How can I create a calculated field to show average sales and number of products sold - so that when a specific product for a town is selected in a powerpivot table the sales can be compared for that product compared with the average for the County and Country?

Thanks in advance

Sean
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Say you have a typical measure:
AvgSold := AVERAGE(SalesTable[NumSold])

So, that works regardless of context. If you put Country on rows, it would be evaluated separately for each Country and "just work". Filtering down to 1 product... same thing. It "just works".

Where things are "interesting" is the "I want the Avg across ALL towns in the county", and... I'm stupid tired, but hopefully get this right...

AvgAllTowns := CALCULATE([AvgSold], ALL(SalesTable[Town]))

Which says "do that same calc, but REMOVE any filter context you have on Town. So, when evaluated in the country of a County... it would be the county-wide average.

(Note, I am pretending you have just 1 table, quite possible you have a geography table, and you would actually put THAT column in the ALL()).
 
Upvote 0
Thank you so much Scott for responding to my request. I will try this today and let you know how I get on.
 
Upvote 0

Forum statistics

Threads
1,224,074
Messages
6,176,220
Members
452,715
Latest member
DebbieCox

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