+ Reply to Thread
Results 1 to 7 of 7

PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

  1. #1
    Registered User
    Join Date
    07-12-2015
    Location
    Uppsala, Sweden
    MS-Off Ver
    2013
    Posts
    28

    Question PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    Hi!


    I want to insert a column in a PivotTable, which calculates the average of four other columns. This can not be done with a calculated field, because the columns are created using the 'Columns' field in the Field list. Terrible explanation, I know, so I tried to attach a demonstration file, but it doesn't work (clicking button does nothing) so please have a look at the attached picture instead. I want to create a column in the PivotTable as in Column J, but within the PivotTable.

    I suspect that this is possible only if I load the table into PowerPivot and create a measure? I'm only learning PowerPivot, so I don't know exactely how this would be done..


    Thank you,
    Alfred

    issue.JPG

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    Hi,

    The averages you show are not the true average of your data - except in the unlikely case that each quarter has exactly the same number of values.
    You shouldn't average averages. You should average the original data.

    Upload the workbook - see the FAQ and maybe we can help further
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-12-2015
    Location
    Uppsala, Sweden
    MS-Off Ver
    2013
    Posts
    28
    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    The averages you show are not the true average of your data - except in the unlikely case that each quarter has exactly the same number of values.
    You shouldn't average averages. You should average the original data.

    Upload the workbook - see the FAQ and maybe we can help further
    Hi Richard,


    Thank you for your reply. I'm not calculating the averages of averages, but averages of sums.


    Alfred

    Edit ok I'll check the faq

  4. #4
    Registered User
    Join Date
    07-12-2015
    Location
    Uppsala, Sweden
    MS-Off Ver
    2013
    Posts
    28

    Re: PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    Voilą the file.. hope this clarifies my question.
    Attached Files Attached Files

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    You can do it with Power Pivot but you will need an additional table with just the 4 quarters in it because you don't have data for every product for every quarter but you want to treat missing data as 0.

    Assuming your existing data is Table1, and the new Quarters table is Table2, you then need to add a relationship between the quarters in the two tables.

    Then you need to add a measure to Table1 called Total_Sales as:
    =IF(COUNTROWS(Table1)>0,SUM(Table1[Sales]),0)
    and another called Month_Average as:
    =AVERAGEX(VALUES(Table2[Quarter]),[Total_sales])

    Once you have added the two measures, you just need to create a set based on the column fields to hide the averages for each quarter and the grand total sum so that you just have the sums by quarter and the total average showing.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    Quote Originally Posted by adh2 View Post
    Hi Richard,


    Thank you for your reply. I'm not calculating the averages of averages, but averages of sums.


    Alfred

    Edit ok I'll check the faq
    Hi,

    The point is still the same. You are taking the average of four totals not the average of the items that make up those totals.

    Take the three discovery items Q1 1305 & 1032, Q3 653. The sum is 3890 and the average of those three items is 1297 and NOT 973.

  7. #7
    Registered User
    Join Date
    07-12-2015
    Location
    Uppsala, Sweden
    MS-Off Ver
    2013
    Posts
    28

    Re: PivotTable: average column of values divided by 'Columns' field. PowerPivot solution?

    Thank you rorya, that worked perfectly!

    Richard, my real data shows sales levels for the products, split by different categories in the ERP system. I want to see the total sales of each product per quarter, and the the average sales per quarter. For 'Discovery' the total sales in Q1 is 1305 + 1932 = 3237, in Q2 it's 0, Q3 653, Q4 0. Hence the average sales, per quarter, is 973. The number 1297 is not interesting in this context.

+ 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] PowerPivot: Merge Month Field and Year Field Into a Date Field
    By mo4391 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-17-2015, 11:59 AM
  2. PowerPivot - Average of the values in a row
    By shadedrivein in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-14-2014, 06:16 PM
  3. [SOLVED] Divided sums of 2 columns with denominator changing based on blank values in a column
    By cujofreak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-31-2013, 11:16 AM
  4. Shift rows below PivotTable down when PivotTable expands (PowerPivot)
    By hektisk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2012, 10:19 PM
  5. SUM and Average of column values based on Month field
    By sourav_tech in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2012, 12:15 AM
  6. Replies: 0
    Last Post: 06-22-2012, 07:13 AM
  7. PivotTable Field List: Adding Columns
    By michaelweaver4 in forum Excel General
    Replies: 1
    Last Post: 03-15-2011, 10:15 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