Calculation in Pivot Table

SchneeBaer

New Member
Joined
Mar 17, 2018
Messages
4
I am trying to create a pivot table that pulls number of hours and hourly rate from two different data sources, and then calculates an extended amount.

To illustrate, below is a sample data source:

ABCD
1NameTypeHrsRate.
2JaneA1025
3JaneB2025
4JaneC3025
5JaneD4025
6JaneE5025
7JohnA510
8JohnB1510
9JohnC2510
10JohnD3510
11JohnE4510

<tbody>
</tbody>
Sheet1
Putting this data into a Pivot Table and adding a calculated field for Hours * Rate, the following displays. The sum for Jane is 3750, and the sum for John is 1250. Note that the Grand Total is not the sum of the rows.

ABCDE
3NameTypeHoursRateTotal
4JaneA1025250
5B2025500
6C3025750
7D40251000
8E50251250
9JohnA51050
10B1510150
11C2510250
12D3510350
13E4510450
14Grand Total27517548125

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3



Collapsing the rows shows the following:

ABCDE
3NameTypeHoursRateTotal
4Jane15012518750
5John125506250
6Grand Total27517548125

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3



I've tried switching the summary function on the rate to average, but that only averaged the two rates in the Grand Total line.

ABCDE
3NameTypeHoursRateTotal
4Jane1502518750
5John125106250
6Grand Total27517.548125

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3



Is there a way to accomplish an accurate total column?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi Baer

Same happens to me, the best way around this is using a helper column in the raw data. ie Column F "=SUM(Hours*Rate)" then when including this column in your PivotTable it will calculate correctly, Let me know if this helps?
 
Upvote 0
Well, darn! I was really hoping for a better answer. This doesn't seem like that unusual of a need.

Unfortunately, my real data set is much more complex, and is pulling directly from 2 SQL tables, one of which has the hours and the other having the rate. For security purposes, we don't want the rates stored with the user-entered hours, and we have too much data to extract it all to Excel.

Thanks for the response though. The only thought I have is to create a SQL view specifically for this pivot table.
 
Upvote 0
Hi SchneeBaer

Have a look at PowerPivot / PowerBI - this newish technology can pull from multiple sources and perform calculations and filters on the data.

It is available from Excel 2010 onwards.

There are plenty of resources out there; this is a start: https://powerpivotpro.com/what-is-power-pivot/

Cheers

pvr928
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,795
Members
449,048
Latest member
greyangel23

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