+ Reply to Thread
Results 1 to 4 of 4

Calculate monthly average in pivot table

  1. #1
    Registered User
    Join Date
    10-06-2021
    Location
    Cincinnati, USA
    MS-Off Ver
    365
    Posts
    6

    Calculate monthly average in pivot table

    Hi there!

    I am attempting to do something that I'm sure is really simple, but I just can't figure it out.
    I have a table of sales data (the source is a power query)... and have created several pivot tables from these data.
    One of these pivot tables shows each service in Rows, and transaction dates (grouped by months and years) in Columns. The Values are sum of qty of sales (units) for each service in each month.
    Table.png

    When I change the Value Field Settings / Summarize value fields by to Average, the pivot table calculates the average of the units within each month rather than the average per month (across all the months):
    Current average.png

    What I would like to do is to add an Average column (ideally in the same pivot table as Sum of Units/Total) that contains the average monthly sales of each service across the whole time scale.
    Needed.png

    I would really appreciate any help in figuring this out... I'm sure I've got a facepalm incoming!

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Calculate monthly average in pivot table

    Not simple. This is more of a work around than a solution.
    Since you have the 365 version of Excel, Power Pivot is an option.
    Two measures are applied in the data model:
    Sum of Units:=SUM(Table1[Units])
    and
    Average of Units:=[Sum of Units]/3
    In the pivot table that is produced columns N, P and R are hidden.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    05-22-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    31

    Re: Calculate monthly average in pivot table

    Greetings,

    I am trying to replicate the solution above, but making an amendment to the average calculation by including a distinct count of the total number of months that have passed + the current month. The implication is that the denominator is not biased upwards unnecessarily making the average smaller than it should be.

    I followed the steps exactly as the solution posted, but I still run into an error.

    1. I added a field, call it Sum_Expenses, which has the following formula: =Sum(Expenses_Amount) where Expenses_Amount contains all the expenses I am summing.

    2. I tried to add another field that averages across months, call it Average_Expenses, which has this formula: =[Sum_Expenses]/SUM(IF(ISTEXT('Expense Data'!E2),1/COUNTIF('Expense Data'!E2:E9999,'Expense Data'E2:E9999),"")) where the denominator counts the number of distinct months (text variable) in a year. The numerator and denominator each work fine independently, but when I try to add this field, I get this error (see image attached).

    Note that I used E2:E9999 because for some reason $E:$E doesn't work. Presumably I can run a slicer on the year and the average will adjust accordingly.
    Attached Images Attached Images

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Calculate monthly average in pivot table

    Administrative Note:

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    In any case, you already have your own thread on this issue.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Calculate monthly average in pivot table
    By SpongeySquidge in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-01-2021, 07:04 PM
  2. Replies: 15
    Last Post: 03-29-2018, 11:29 AM
  3. Calculate Average from Pivot Table
    By mazcarate in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-07-2017, 01:36 PM
  4. Replies: 1
    Last Post: 03-05-2015, 05:17 PM
  5. formula,macro or pivot table for calculate monthly sale
    By maabadi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-13-2013, 01:32 PM
  6. 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
  7. Getting Pivot Table to give monthly Average
    By ChemistB in forum Excel General
    Replies: 6
    Last Post: 09-27-2010, 02:03 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