+ Reply to Thread
Results 1 to 4 of 4

Duplicate a simple table with a Pivot Table

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    33

    Duplicate a simple table with a Pivot Table

    Hi Excel heroes,

    Please help me create a pivot table. It needs to show a rolling sales for 1 week, 4 weeks and 13 weeks (as well as a few simple metrics). Every new week new data gets added, the pivot must look back in those rolling increments. So that at work on Feb 4th, it looks back at weekending Feb 2nd.

    I guess it has something to do with Calculated Fields but I can't figure it out.

    I have attached the sample file and how the table would look.

    Thank you in advance!
    Attached Files Attached Files
    Last edited by virsilens; 01-29-2019 at 11:48 PM.

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

    Re: Duplicate a simple table with a Pivot Table

    Quick Question: By prior week, do you mean week ending last Saturday or the 7 days prior to the current date?
    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
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,956

    Re: Duplicate a simple table with a Pivot Table

    Never mind. You want week ending. I can see that by the title.

    Many times you can solve pivot table issues with helper columns on the source data.

    First of all, I converted your data into an Excel Table. There are two reasons for this:
    - Excel tables "know" how big they are, so you do not have to change the pivot table data source range. All you need to do is refresh the pivot table when you add new data.
    - Excel tables copy down formulas automatically. This means that the helper column formulas will copy down when data is added.

    First I started with some calculations.
    Cell B1 has the current day
    Cell C4 is the end of the prior week (Saturday)
    Cell C5 is the end of the 4th week
    Cell C6 is the end of the 13th week

    The corresponding cells in column B are the previous Sundays (week start)

    So last week is data from Week 1 Start to Week 1 End
    4 weeks is Week 4 Start to Week 1 End
    13 weeks is Week 13 Start to Week 1 End

    I gave names to these cell values just to make the formulas easier to read.

    The formulas for the three columns are:
    Prior 1 =IF(AND([@WEEKENDING]>=P1_Start,[@WEEKENDING]<=P1_End),[@DOLLARS],0)
    Prior 4 =IF(AND([@WEEKENDING]>=P4_Start,[@WEEKENDING]<=P1_End),[@DOLLARS],0)
    Prior 13 =IF(AND([@WEEKENDING]>=P13_Start,[@WEEKENDING]<=P1_End),[@DOLLARS],0)

    If the date is outside the range, no dollars otherwise use the dollar amount associated with the range.

    I used these columns in the pivot table.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Duplicate a simple table with a Pivot Table

    Ah-Maze-Zing

    This is fantastic insight dflak - thank you so much. +10 hero points.

+ 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] Building simple pivot table
    By jaryszek in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 02-05-2019, 08:18 AM
  2. [SOLVED] Simple Pivot Table using VBA
    By kersplash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2017, 12:07 AM
  3. Replies: 6
    Last Post: 01-24-2017, 06:56 PM
  4. Pivot Table - probably really simple (but not for me!)
    By Wilgoss in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-23-2013, 04:47 AM
  5. Pivot Table question, may be a simple one!
    By PhoenixJR in forum Excel General
    Replies: 2
    Last Post: 06-27-2012, 09:28 AM
  6. simple pivot table question
    By charliec in forum Excel General
    Replies: 5
    Last Post: 05-05-2011, 02:46 PM
  7. Pivot Table - simple question
    By s boak in forum Excel General
    Replies: 3
    Last Post: 04-21-2006, 08:10 AM

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