+ Reply to Thread
Results 1 to 3 of 3

Calculating Std Dev on Pivot Results (Not Source Data) Across Columns

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    Philadelphia, PA
    MS-Off Ver
    2013
    Posts
    11

    Red face Calculating Std Dev on Pivot Results (Not Source Data) Across Columns

    I'm trying to calculate the standard deviation by different time intervals. My data table includes customer, sale date, product type, container date, lbs sold, and source plant.

    I want to calaculate standard deviation for each row (rows are customers, products, and shipment container) across columns (in this case months 1...12,and weeks 1 ....52) with values being the pounds of product. I want to get a standard deviation calculated for each row across the month columns and the standard deviation needs to be done on the pivot results, not the source data. I also want to use in the calculation data from each month even if that data doesnt exist (i.e. if no sales for that customer for that product in that shipment container, consider that month sales of 0). This effects the standard deviation.

    I'd share a table, but the problem is, its full of sensitive information and would take a long time to dummy. (unless you have a short cut way to dummy a table.)
    Tim

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Calculating Std Dev on Pivot Results (Not Source Data) Across Columns

    The way I handled this with one of my programs is that I set up a series of helper columns to the left of my pivot table since I had no idea how many rows it would extend to the right. These were to calculate Average, StdDev and LCL and UCL.

    I establish a "baseline" named dynamic range for the dates using offset.

    Then based on the row number I used the formulas for Average and StdDev against unnamed dynamic range off of the named range.

    For example, my date row in the pivot table starts in Cell H12.

    So the named range is Date_Range =OFFSET('IVC Pivot'!$H$12,0,0,1,COUNT('IVC Pivot'!H12:AZ12)) I'm fairly certain my dates won't go out as far as column AZ.

    Then the average for row 13 is Average(OFFSET(Date_Range,row()-12,0))

    I extended the formula for my 4 items down about 100 rows beyond where I expect the rows of data in the pivot table to end. For "cleanliness" sake, I wrapped the formulas in an IFERROR to eliminate where I'm trying to take averages or standard deviation of non-existent rows.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-08-2018
    Location
    Philadelphia, PA
    MS-Off Ver
    2013
    Posts
    11

    Re: Calculating Std Dev on Pivot Results (Not Source Data) Across Columns

    Thanks for the input. Your method is similar to the method I have been using where I calculate the Std dev outside of the table. I did it on another tab and referenced each cell for each month within the std dev formulate (shown below) and did the same by week. I extended this past the current last values incase the sheet grew. It still isnt perfect and won't work if I added another column. I was hoping that there was a method to calculate it it using Power Pivot and DAX functions.

    Maybe that is impossible?

+ 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] Change Data Source of Pivot Tables, Omit Blank Rows/Columns
    By hchavous in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2018, 09:07 AM
  2. Replies: 0
    Last Post: 01-06-2016, 07:00 AM
  3. Replies: 2
    Last Post: 06-23-2014, 11:05 AM
  4. Replies: 3
    Last Post: 03-28-2014, 01:36 PM
  5. Replies: 2
    Last Post: 03-07-2013, 02:16 PM
  6. Hidden columns in pivot table source data
    By Kaigi in forum Excel General
    Replies: 2
    Last Post: 07-17-2009, 09:34 AM
  7. Pivot Table data source "data source contains no visible tables"
    By Jane in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-29-2005, 04:05 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