+ Reply to Thread
Results 1 to 9 of 9

Calculating A Weighted Average In a Pivot Table

  1. #1
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Calculating A Weighted Average In a Pivot Table

    Good afternoon, folks!

    Please see the attached workbook. I hope the layout of the pivot table is explanatory enough for you, but I’ll try my best to explain what I’m trying to do in words. We have Delivery Instruction numbers (hereafter “DIs”) that are created when allocations from a central inventory location are generated to replenish items sold out of our stores. The central location then ships the bulk allocations to 11 support centers (called the “SHIPPER” in the attached data) which then ship to the individual stores.

    The metric I’m trying to determine is the average allocation duration, by SHIPPER, for each leg of the process between DI_CREAT_DATE and STR_ARRIVAL_DATE, then a weighted average of those averages, e.g.: one SHIPPER with a single DI that had a duration of 50 days unfairly weights when another SHIPPER that had 5 DIs with an average of 5 days duration, so the subtotal average is skewed.

    I tried looking up using a weighted average in a pivot, and Google does make it seem like it can be done, but the instructions don’t marry up with what I’m seeing in my version of Excel (2016.) Can anyone offer some help or ideas?

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Calculating A Weighted Average In a Pivot Table

    Use a calculated column to do
    SUM(DIs) / SUM(Days)
    to get an average of DIs per day (or swap the calculation to get days per DI)


    Note that you cannot calculate this line by line in the source data, it has to be aggregate data.

  3. #3
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Re: Calculating A Weighted Average In a Pivot Table

    Quote Originally Posted by Stormin' View Post
    Use a calculated column to do
    SUM(DIs) / SUM(Days)
    to get an average of DIs per day (or swap the calculation to get days per DI)


    Note that you cannot calculate this line by line in the source data, it has to be aggregate data.
    Thanks for the reply, but I don't believe this is what I'm looking for. You're offering a straight average; I'm trying to get a weighted average, one which accounts for each SHIPPER's significance to the average before averaging for the whole network.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Calculating A Weighted Average In a Pivot Table

    read this and re-read post #2 Weighted Average in PT 2010
    or
    use PowerPivot / PowerQuery where you can define what you want in calculated columns or calculated fields
    or (pattern)
    col1*col2/col1
    Last edited by sandy666; 07-26-2017 at 10:13 AM.

  5. #5
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Re: Calculating A Weighted Average In a Pivot Table

    Quote Originally Posted by sandy666 View Post
    read this and re-read post #2 Weighted Average in PT 2010
    or
    use PowerPivot / PowerQuery where you can define what you want in calculated columns or calculated fields
    or
    col1*col2/col1
    That link is exactly what I found, but I think I might have misread it; I'll give it another shot...

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Calculating A Weighted Average In a Pivot Table

    Don't quote full post

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Calculating A Weighted Average In a Pivot Table

    Or you can try this way:
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Calculating A Weighted Average In a Pivot Table

    Ah, we are talking about different weighted averages. I actually opened your workbook this time

    Quote Originally Posted by Mvaldesi View Post
    so the subtotal average is skewed
    Subtotal averages in pivot tables are already weighted.

    Another way of showing how much a shipper contributes to total duration is to show sum duration as % of grand total.


    See attached workbook.
    Attached Files Attached Files

  9. #9
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Re: Calculating A Weighted Average In a Pivot Table

    Quote Originally Posted by Stormin' View Post

    Subtotal averages in pivot tables are already weighted.
    Well, hell, I see that now! Thanks for your help!

+ 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. Weighted Average Pivot Table Sub Groups
    By Cheeseburger in forum Excel General
    Replies: 1
    Last Post: 10-25-2016, 03:52 AM
  2. Weighted Average in a Pivot Table
    By Maverick 3672 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 04-24-2013, 08:51 AM
  3. How can I calculate a weighted average in a Pivot Table?
    By petevang in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-23-2012, 12:56 PM
  4. [SOLVED] Weighted Average in Pivot Table
    By sinspawn56 in forum Excel General
    Replies: 2
    Last Post: 04-05-2012, 05:26 PM
  5. Weighted Average in a Pivot Table
    By rmikulas in forum Excel General
    Replies: 2
    Last Post: 07-14-2010, 05:08 PM
  6. Calculating weighted average subtotals in a pivot table
    By Jack10063 in forum Excel General
    Replies: 3
    Last Post: 10-19-2009, 09:00 AM
  7. weighted average in pivot table
    By nasser in forum Excel General
    Replies: 3
    Last Post: 01-18-2006, 12:40 PM

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