+ Reply to Thread
Results 1 to 5 of 5

Divide by count of months in cube pivot

  1. #1
    Registered User
    Join Date
    03-12-2015
    Location
    Billings, MT
    MS-Off Ver
    2013
    Posts
    3

    Divide by count of months in cube pivot

    Spreadsheet chooses a date of fiscal year. Can have 1 to 12 months in it. The grand total is the last column and then I want to add a calculated Year to Date average. The grand total keeps getting summed into my calculated average unless the sheet has 12 months in it.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Divide by count of months in cube pivot

    any chance you can upload an example?
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    03-12-2015
    Location
    Billings, MT
    MS-Off Ver
    2013
    Posts
    3

    Re: Divide by count of months in cube pivot

    Hello, I have updated an example from our test server. So this sheet has five months in it. The Average column is a calculated
    field outside of the pivot table. So when we are attached to the olap cube, by using a fiscal or calendar date for a specific year, the report adds the mew monthly column automatically and the Grand total columns moves to the right each month.

    I tried using the calculation below but I don't have the count correctly. I need it to count the number of months, in this example
    I want to divide by 5 months. Can you tell me how to do that?



    =SUMIF(B8:M8,"<>0")/COUNTIF(B8:M8,">=0")
    Attached Files Attached Files

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Divide by count of months in cube pivot

    Two problems - you are summing the values from columns B through M - that means you are including the Grand Total. Including the grand total is a problem in both your numerator and denominator.

    Try replacing SUMIF(B8:M8,"<>0") with SUMIF(B8:M8,"<>0")/2 - that undoes the problem of including the grand total. Also, you shouldn't need to bother with the SUMIF( RANGE, "<>0") condition because adding a zero doesn't change the value of the sum.

    So, your SUM would just be: SUMIF(B8:M8)/2 (again, the 'divide by 2' is just to eliminate the over summing from the grand total row).


    You mention you want to divide by 5, but your formula appears to want to neglect months in which the value = 0.

    IF YOU DO want to count months with a zero value:
    I would just count on the 7th row to get the number of months (use COUNTA() instead of COUNT): COUNTA($B$7:$M$7)-1) - the minus 1 removes the count from the grand total.

    Total formula becomes(paste into O8 and copy down): =SUM(B8:M8)/2/(COUNTA($B$7:$M$7)-1)


    IF YOU DO NOT want to count months with a zero value:

    We just use the 'minus 1' in your COUNTA function to remove the count of the GT column, and since the table is showing zeros as blanks, you have this: =SUM(B8:M8)/2/(COUNTA(B8:M8)-1)

  5. #5
    Registered User
    Join Date
    03-12-2015
    Location
    Billings, MT
    MS-Off Ver
    2013
    Posts
    3

    Re: Divide by count of months in cube pivot

    Thank you for your reply!!

+ 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] Divide the net value into months
    By oozden in forum Excel General
    Replies: 2
    Last Post: 04-24-2014, 02:28 PM
  2. Replies: 2
    Last Post: 03-19-2014, 07:26 PM
  3. Pivot Table, Divide by count of months?
    By DoriBeE in forum Excel General
    Replies: 2
    Last Post: 05-10-2011, 04:20 PM
  4. pivotItems.count is always 0 , when datasource is OLAP cube
    By newbie11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-04-2009, 12:06 AM
  5. Pivot Table - OLAP Cube
    By dlinvfc in forum Excel General
    Replies: 0
    Last Post: 01-30-2006, 08:30 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