Average of subtotals in a pivot table

Rm385

New Member
Joined
Apr 28, 2005
Messages
4
Hi,

I know that this has been asked multiple times before but I just can't figure out the answer from the answers that I found so far.

So here goes. I have data organized like this (there are multiple fees but this is just an example):

Code:
Proj Descr	Acct Descr	Amount	Issue
Feature 1	 Art Fee	    100	    1
Feature 1	 Art Fee	    200	    1
Feature 1	 Art Fee	    300	    1
Feature 2	 Art Fee	    400	    1
Feature 2	 Art Fee	    500	    1
Feature 2	 Art Fee	    600	    1
Feature 3	 Art Fee	    700	    1
Feature 3	 Art Fee	    800	    1
Feature 3	 Art Fee	    900	    1
Feature 3	 Art Fee	    1000	   1
Feature 4	 Art Fee	    1100	   2
Feature 4	 Art Fee	    1200	   2
Feature 4	 Art Fee	    1300	   2
Feature 4	 Art Fee	    1400	   2
Feature 5	 Art Fee	    1500	   2
Feature 5	 Art Fee	    1600	   2
Feature 5	 Art Fee	    1700	   2
Feature 5	 Art Fee	    1800	   2

To get totals of amount for fee for each issue I have created a pivot table. The total for Feature 1 is 600, for Feature 2 is 1500, for Feature 3 is 3400, etc.

Now I need the average of totals for features for each issue. For example, I should see 1833.33 for Issue 1 and 5800 for Issue 2. If I just add average to the pivot table, it averages all the lines that went into the subtotal, and that is not what I need (I get 550 for Issue 1 and 1450 for Issue 2).

I guess I've been thinking about this too much and just can't see a simple solution anymore. What am I missing? Can someone please help me?

Thank you!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
try this
Book2
ABCDE
3AmountIssue
4Proj Descr12Grand Total
5Feature 1600600
6Feature 215001500
7Feature 334003400
8Feature 450005000
9Feature 566006600
10Grand Total55001160017100
111833.33335800
Sheet4


after pivot table is created I added the average formulas

HTH
texasalynn
 
Upvote 0
Thanks for the response!

The problem is that my actual data is more complicated. The way the pivot table is set up it has Issue and Proj Descr in the row area (there are dozens of issues, so I want to show them vertically), and Account Descr (there are at least 2 per issue) are in the column area. So I can't figure out how to where to add an average formula.
 
Upvote 0
Is this something like what you wanted?

If it is, here's what I've done. I created calculated items in Issue. Here's the steps.

1. Set up your pivot table where Issue and Project description are the row fields and Amount and Another Amount are the data fields (both calculated as SUMS).
2. Right Click on issue, go to Formulas, and Calculated Items. Create a title for your calculated item (ie. "Issue 1 Average"). The actual formula for Issue 1 Average is Issue[1] /3, where is [1] does not refer to issue 1, is refers to the first item in the field (it's just a coincidence they are the same number in this case). 3 is the number of features for this particular issue.
3. Repeat these steps for "Issue 2 Average", the formula will be Issue[2]/2 because there are 2 feature items.
4. Finally, double click on Issue 1 Average and Issue 2 average to hide the details.

That's it! I hope it works out for you.

Source Data
Book3
ABCDEF
1Project DescriptionAcctDescrAmountAnother AmountIssue
2Feature 1ArtFee$ 100.00$ 165.521
3Feature 1ArtFee$ 200.00$ 246.441
4Feature 1ArtFee$ 300.00$ 525.681
5Feature 2ArtFee$ 400.00$ 876.151
6Feature 2ArtFee$ 500.00$ 881.291
7Feature 2ArtFee$ 600.00$ 381.491
8Feature 3ArtFee$ 700.00$ 855.951
9Feature 3ArtFee$ 800.00$ 507.191
10Feature 3ArtFee$ 900.00$ 283.611
11Feature 3ArtFee$1,000.00$ 520.671
12Feature 4ArtFee$1,100.00$ 719.452
13Feature 4ArtFee$1,200.00$ 942.732
14Feature 4ArtFee$1,300.00$ 732.742
15Feature 4ArtFee$1,400.00$ 482.952
16Feature 5ArtFee$1,500.00$ 290.882
17Feature 5ArtFee$1,600.00$ 946.282
18Feature 5ArtFee$1,700.00$ 603.402
19Feature 5ArtFee$1,800.00$ 248.752
Sheet1


Pivot Table
Book3
HIJK
4IssueProject DescriptionAmountAnother Amount
51$ 5,500.00$ 6,853.20
6Feature 1$ 600.00$ 2,445.84
7Feature 2$ 1,500.00$ 1,500.17
8Feature 3$ 3,400.00$ 2,907.19
9
102$11,600.00$ 4,076.95
11Feature 4$ 5,000.00$ 2,383.75
12Feature 5$ 6,600.00$ 1,693.21
13
14Issue 1 Average$ 1,833.33$ 2,284.40
15
16Issue 2 Average$ 5,800.00$ 2,038.48
Sheet1
 
Upvote 0
You mean like this PivotTable...
Book1.xls
ABCD
2IssueProj DescrSum of Amount
31Feature 1600
4Feature 21500
5Feature 33400
61 Average1833.333333
72Feature 45000
8Feature 56600
92 Average5800
10Grand Total17100
Sheet2
 
Upvote 0
Yes, like this table. How do I make it stop averaging all the lines that went into each line in the Sum of Amount column?
 
Upvote 0
Rm385 said:
Yes, like this table. How do I make it stop averaging all the lines that went into each line in the Sum of Amount column?

Obviously, the reason the Average summary function wasn't producing the desired results was that the denominator wasn't based on the rows displayed by the PivotTable, but rather on the rows in the underlying data that you originally posted. The "secret" to resolving this is to base your PivotTable on a summary of the original data so that the denominator will be equivalent to the number of rows representing distinct 'Proj Descr' items for each 'Issue' item. This can be accomplished by querying your original data as though it was External Data (using the Excel ODBC driver and MS Query) with this query...

SELECT List.Issue, List.`Proj Descr`, Sum(List.Amount)
FROM Book1`.List List
GROUP BY List.Issue, List.`Proj Descr`

The results of this query...

  • Issue `Proj Descr` Amount
    1.0 Feature 1 600.0
    1.0 Feature 2 1500.0
    1.0 Feature 3 3400.0
    2.0 Feature 4 5000.0
    2.0 Feature 5 6600.0

...now becomes the source data for the PivotTable. Then all that's needed is a Custom Subtotal for 'Issue' using Average as the summary function.

(600+1500+3400)/3 = 1833.33...
(5000+6600)/2 = 5800
 
Upvote 0
Wow, this is a bit more complicated that I was hoping for. Thank you! I made it work with the sample data, now I just need to apply the same logic to my original data.
 
Upvote 0

Forum statistics

Threads
1,218,246
Messages
6,141,363
Members
450,352
Latest member
lohpa

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