In a pivot table, can I adjust the logic for calculating subtotal averages?

jjjason10

New Member
Joined
Apr 30, 2018
Messages
5
Good Afternoon All,

I've spent the last few hours searching for this issue with no luck, so I apologize if this has been posted already.

If I add a subtotal to a pivot table and make the subtotal calculate as "Average", I'm wondering if there is a way to adjust how excel calculates the average. Below is a snippet of sample data, similar to my pivot table. I have a few sales teams where I show each individuals total, then there is a roll up into the team total. I also have it set up so that I can see the team average. However my data set feeding the table has a line of data for each day of the sales cycle. As a reference, TEAM A has 383 lines of data in the date set. It appears that when I add in the subtotal Average, excel is calculating the average based on the number of lines of data in the data set and not the number of employees on the team. The numbers in Red font to the right of the table are my expected resultes (Taking the sum divided by 6). Is there anyway I can acheive this with in the table, and not use formulas in external columns.




Book1
ABCDEFG
3Row LabelsSum of LeadsSum of ContactedSum of Sale
4North1062.00678.00265.00
5TEAM A
6Employee 177.0058.0023.00
7Employee 296.0090.0035.00
8Employee 383.0073.0021.00
9Employee 4124.0073.0039.00
10Employee 596.0081.0021.00
11Employee 681.0051.0018.00
12TEAM A Sum557.00426.00157.00
13TEAM A Average1.451.110.41937126
14TEAM B
15Employee 1175.0079.0038.00
16Employee 293.0058.0032.00
17Employee 391.0048.0018.00
18Employee 487.0049.0019.00
19Employee 559.0017.001.00
20Employee 60.001.000.00
21TEAM B Sum505.00252.00108.00
22TEAM B Average1.840.920.39844218
23Grand Total1062.00678.00265.00
Sheet3
Cell Formulas
RangeFormula
E13=B12/6
E22=B21/6
F13=C12/6
F22=C21/6
G13=D12/6
G22=D21/6
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
TEAM ATEAM Aleadscontactedsales
TEAM AEmployee 1775823TEAM A Sum557426157
TEAM AEmployee 2969035TEAM A Average1.451.110.41
TEAM AEmployee 3837321
TEAM AEmployee 41247339
TEAM AEmployee 5968121TEAM B Sum505252108
TEAM AEmployee 6815118TEAM B Average1.840.920.39
Grand Total1062678265
TEAM BTEAM B
TEAM BEmployee 11757938
TEAM BEmployee 2935832
TEAM BEmployee 3914818
TEAM BEmployee 4874919
TEAM BEmployee 559171
TEAM BEmployee 6010
TEAM BEmployee 7334455
note team B has 7 employees
leadscontactedsales
TEAM A557426157
TEAM B505252108
emps
TEAM A6
TEAM B7
averages
leadscontactedsales
TEAM A92.833337126.16666667
TEAM B84.166674218
these tables all produced using sumproduct

<colgroup><col><col><col span="7"><col><col span="4"></colgroup><tbody>
</tbody>
 
Upvote 0
Thanks for the response oldbrewer. I'm not 100% sure I follow though, are you suggesting to use sumproduct in the pivot table? If so, how would I do that?
 
Upvote 0
wasnt sure if your data is pivot table output - if so it looks like raw data. My output is by processing raw data
 
Upvote 0
Ahhh, yeah. The output is pivot data, my bad. Without the ability to attach a file, I wasn't completely sure how to provide a viewable example. I used the mr.excel add-in.
 
Upvote 0
The dataset can be modified - summed by employee - between the source & the pivot table, using SQL. SQL detail will be specific to your data - so without knowing that I can't advise.

To set it up, approach is save the data file, then from a new file (CTRL-N) keystrokes ALT-D-N to start the pivot table wizard, then choose external data source at the first step, next, get data, browse for your file. If you haven't got a simple (non-dynamic) named range for the source data there might be a message about no visible tables - just OK to that and then via 'options' choose 'system tables' to see worksheet names - choose the name of the named range or worksheet with the data. Continue to the end & then choose the MS Query option. Within MS Query modify the SQL, see the modified dataset, then exit MS Query & make a pivot table. The entire worksheet containing the pivot table can be moved to the source data workbook if you like.

regards, Fazza
 
Upvote 0
In this case I think analysis of raw data without using pivot tables may be best. Show us 20 lines of raw data - anonymised if necessary.
 
Upvote 0
Thanks for the responses oldbrewer and Fazza. The data tends to be pretty dynamic with reps changing teams frequently, so not using pivot tables might require a lot of manual up keep. I didn't really think this was an easy/doable solution, so I think i'm going to move forward with my plan B. I'll build a 2nd query that sums all the data at the rep level then build a 2nd tab to display averages. I think that will be as effective as building out the SQL piece.

Thanks again for the ideas.
 
Upvote 0
teamnameleadscontactedsales
TEAM BEmployee 11757938
TEAM AEmployee 3837321in this example people switch teams
TEAM BEmployee 3914818
TEAM AEmployee 5968121
TEAM AEmployee 2969035leadscontactedsales
TEAM BEmployee 459171TEAM A557426157
TEAM AEmployee 4815118TEAM B451247144
TEAM AEmployee 1775823
TEAM BEmployee 63344551008673301check
TEAM AEmployee 61247339
TEAM BEmployee 5010
TEAM BEmployee 2935832
1008673301check

<colgroup><col><col><col span="12"></colgroup><tbody>
</tbody>
 
Upvote 0
I'll build a 2nd query that sums all the data at the rep level then build a 2nd tab to display averages. I think that will be as effective as building out the SQL piece.

Yes, a similar approach though with more transparency.

I forgot yesterday that the GUI in MS Query will enable what is wanted without needing to manually edit the SQL. You can just delete the day field and then select the value field to be summed and press the upper case sigma icon. The 'plan B' query you'll be creating will be identical, I think, and just be an extra step (though with the benefit of transparency, and a small cost in memory and the extra step en route to the result).
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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