Need max value for month in pivot table

El_Kabong

New Member
Joined
Apr 3, 2014
Messages
7
My source table in my Excel workbook is populated from a data connection which executes a stored procedure in SQL Server, and is refreshed every time the value in one of the cells that are the parameters for the data connection/stored procedure changes (columns delineated by semicolon):

trans type;month;category;sales;gross margin;ship days in month
Current;April,2014;Widgets;$5000;$2000,22
Current;April,2014;Forms;$5000;$2000,22
Current;April,2014;Brackets;$5000;$2000,22
Current;May,2014;Widgets;$5000;$2000,23
Current;May,2014;Forms;$5000;$2000,23
Current;May,2014;Brackets;$5000;$2000,23
Future;June,2014;Widgets;$5000;$2000,20
Future;June,2014;Forms;$5000;$2000,20
Future;June,2014;Brackets;$5000;$2000,20
Future;July,2014;Widgets;$5000;$2000,22
Future;July,2014;Forms;$5000;$2000,22
Future;July,2014;Brackets;$5000;$2000,22

In the pivot table built from this data table, the first three columns are the row labels, then the columns are sales, gross margin, gross margin percent (gm/sales), and daily sales (sales/ship days).

My problem is daily sales. At the root level, it works fine. But since calculated fields automatically assume the SUM of the fields involved, the math breaks down at the upper levels. It should be using the MAX (which is how I've set the column in the pivot table).

Other than sticking a "totals row" into the output (which would defeat the purpose of the pivot table), how do I make sure the Future/July,2014 row in the pivot table results in $15,000/22 as the daily sales?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Never mind, the solution occurred to me about 10 seconds after I posted.

I added a column to the output called rec count that returned a 1 for each record, and the calculation for daily sales is now sales / (ship days / rec count)

Figured I'd put this here so anyone googling for a solution would find it.
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,546
Members
449,169
Latest member
mm424

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