Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calcuate % using only subtotal data in a pivot table

Status
Not open for further replies.

itprsn

MIS
Jan 6, 2004
40
US
Data looks like the attached:

product order press printed overrun waste %
newspaper1 10,000 4 5,760
newspaper1 10,000 5 5,840
newspaper1 10,000 n/a n/a 1,600
Summary 10,000 All 11,600 1,600 xx.xx


What I need to do is calculate a waste % based on the information that is found summarized on the subtotal line. Any suggestions as to how I can do this? Thanks...
 




Hi,

Your % column...
[tt]
=IF(E2>0,E2/SUMIF(order,B2,printed),0)
[/tt]
using named ranges.

Skip,
[sub]
[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue][/sub]
 
Not sure I understand how this works in pivot table?
 




[tt]
Data
order Sum of printed Sum of overrun Sum of waste%
10,000 11600 1600 14%
Grand Total 11600 1600 14%
[/tt]

Skip,
[sub]
[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue][/sub]
 
Let me try and clarify: in SQL I'm pulling several records for each product's press runs and using a union to pull in one additional record for the total of all press runs for that product (to get the overrun I'm looking at all the press runs in total, then comparing to the order). All's good so far. Then I pull the detail records and the summary record into a pivot table and subtotal all the data so I have it all on one line. Then what I'm attempting to do is to create a new field and get the waste % to print in that new field on the summary/subtotal line. So far my new field is only printing on the detail lines, not the summary/subtotal lines where I need it to be... Thanks...
 




Works for me when you INCLUDE the formula in a adjacent column in the source data query table AND make sure the Data > Import External Data > Data Range Properties has the box at the bottom checked. THEN, use this data in your PT. Pretty simple!

Skip,
[sub]
[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue][/sub]
 
Got it, adding an adjacent column in the data source was new to me but I understand where you're going with this now... Thanks for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top