+ Reply to Thread
Results 1 to 9 of 9

Pivot Table Calculated Field - Sum of Column A * Min of Column B

  1. #1
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Pivot Table Calculated Field - Sum of Column A * Min of Column B

    I am looking to create a calculated field where a sum of column A is multiplied by a min of column B. What seems to be happening instead is simply a multiplication of a sum of both columns.

    So:
    Please Login or Register  to view this content.
    So, what I want
    2736 * .93
    What seems to be happening
    2736 * 5.73

    My formula in the calculated field is
    Please Login or Register  to view this content.
    How can I get the result I want in a Pivot Table?
    Last edited by Whizbang; 11-06-2014 at 10:16 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    Pivot tables typically summarize redundant data... your calculated goal would appear in the Pivot Table in what way? If all you want is the answer, you don't need a Pivot Table at all, do you? Can you show us what you have so far in terms of Pivot Table results and point out where you're wanting this single value to appear?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    Sorry. I tried to simplify my problem to prevent confusion. I guess I went too far. Please see the attached.

    I am trying to calculate a target based on a sum of a column (actually a sum of one column divided by the sum of another), then multiply the result by a variable modifier to get a target value. The modifier is in another table, but since I cannot do a lookup in a pivot table without first doing some sort of join query, I have used a lookup formula in my data table to pull this data in. Unfortunately this results in the same modifier repeated throughout my data when I only need it once per year per product family.
    Attached Files Attached Files
    Last edited by Whizbang; 11-05-2014 at 04:37 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    Sum of Column ??
    Divided by the Sum of Column ??
    Mulitplied by a variable found ??


    One complete example including the result from the sample data set you've uploaded is what we need to start.

  5. #5
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    I am attempting to divide the sum of one column by the sum of another and then multiply the result by a lookup value. The division part of the equation is irrelevant to my question, but I supplied that information to better explain my workbook. I get the same issue if I am multiplying the sum of a column by the lookup value.

    What I need to do, in short, is multiply the sum of a column by a lookup value. However, because I cannot do a lookup in a pivot table, i must do it in my data. This results in duplication of data. I thought to mitigate this by using MIN() (I could have just as easily done Average or Max, as all values within the group will be the same), however it appears that either it is summing the column and then applying MIN, or it is applying MIN to each record and then summing the result.

    I have added a "Should Be" column in my workbook and highlighted the field in question, if that helps in any way.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-18-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013+
    Posts
    18

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    I am trying to understand what you are trying to do but cannot figure it out. I will try to explain how pivots work to a least help you in some way.
    (1) Pivot calculations only work directly with the data table, never with the resulting pivot table values.
    (2) Pivot calculations work with columns (not rows like excel): So at each step of the way it is working with resulting column data.
    (3) Before any calculations is carried out the pivot engine determines the the column result.
    (4) To determine each column result, all filters are first applied to the data table.
    (5) The "user defined formulas" are finally applied to the cumulative column results.
    (6) Steps 3 to 5 are repeated for every single pivot cell.

    To see this partially in action go to D4 in the example you posted, then double click.
    A new sheet will be inserted containing the detail rows (after applying filters) making up the calculation of D4
    Look at this sheet and try to work out the D4 result based on what I described above.

    Hope this helps to resolve some of the pivot table mystery. Things start to get even more interesting once you transition to power pivots.

  7. #7
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    I ended up adding a helper column in my data which I called "CountingColumn" with a value of 1 in all rows. This way when it sums my target modifier I then divide the result by the sum of the counting column, essentially returning me to the value I need by giving me the average in a roundabout way.

    Thank you both for trying. I know sometimes figuring out what others are trying to accomplish can be difficult.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-20-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    1

    Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    I was trying to do something similar and did a lot of brain storming. Thanks for sharing this, it helped a lot.

  9. #9
    Registered User
    Join Date
    09-25-2019
    Location
    Greece
    MS-Off Ver
    MS Office 2016
    Posts
    1

    Thumbs up Re: Pivot Table Calculated Field - Sum of Column A * Min of Column B

    Thanks for sharing, I was trying to do something similar & the idea with Counting Column really helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Referring to a Sub-Field on Calculated Field Pivot Table Column?
    By figo12 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-27-2014, 02:02 PM
  2. Replies: 0
    Last Post: 03-02-2013, 08:15 AM
  3. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  4. Adding new calculated/column field to pivot table
    By MARYAN in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2010, 05:34 AM
  5. Replies: 3
    Last Post: 02-23-2009, 10:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1