Advanced Run Sum Pivot

tgartner

New Member
Joined
Oct 5, 2010
Messages
3
I need to create a running sum in a pivot, which in itself is not hard to do as long as the running sum is only columnar or row based. What if the runnung sum is on both... let me explain... lets assume that the column headers in the pivot are dates grouped by month and year (Jan, Feb, Mar/ 2000, 2001, 2002, etc). And the row headers are the days of those months (1, 2, 3, 4, 5, 6...). and the value field is the daily net change in a bank account (-$34, $125, etc, etc). Is it possible to create an entire running account balance by day by month (and year) in a pivot?

2010 2011
Jan Feb Mar... Jan Feb Mar...
1 ($34) ...
2 125 ...
3 ...
4
5
6
...
6
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi,

I am a little confused: the requirement is for a running sum and the value field is the daily net change -34, 125, etc. I would expect the answer is then -34, 91, etc whereas the sample result shows as -34, 125, etc. I have answered as I expect & assumed the sample result (in the question) is wrong. If this isn't correct, please clarify - or modify below to suit.

I started with sample data in two columns: MyDate & Value. I gave the entire source data the defined name (normal, non-dynamic) of MyTable. Save the file.

From a new file, start the pivot table wizard ALT-D-P taking the external data option at the first step and follow the wizard to the end taking the option to edit in MS Query. Hit the 'SQL' button and replace the SQL by
Code:
SELECT Day(A.MyDate) AS [MyDay], Month(A.MyDate) AS [MyMonth], Year(A.MyDate) AS [MyYear], SUM(B.Value) AS [MySum]
FROM MyTable A, MyTable B
WHERE A.MyDate >= B.MyDate
GROUP BY A.MyDate
OK to enter this. (And OK to any messages you get.) See a dataset. Hit the 'open door' icon to exit MS Query & make the pivot table. MyDay as a row field, MyYear and MyMonth as column fields, sum of MySum as the data field showing the running total. If you like, the resultant worksheet containing the pivot table can be moved into the source data file.

regards, Fazza
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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