+ Reply to Thread
Results 1 to 13 of 13

How to make cumulative spend chart from pivot

  1. #1
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    How to make cumulative spend chart from pivot

    I'm having trouble doing something that feels like it should be basic, but I'm not sure if the solution lies in with the way my data is arranged, the way the pivot table is set up, or the way I'm making a chart.

    I have a table where I input amounts I've spent, and want a graph that tracks my total spend.

    I will sometimes have more than one line item per day. Eg:

    Monday - £10
    Monday - £20
    Tuesday - £15
    Tuesday - £10
    Wednesday - £5

    I would then want the chart to show 3 data points. £30 spent on Monday, £55 spent by Tuesday and £60 spent by Wednesday.

    My pivot chart will happily summarise the days, and output £30 for Mon, £25 for Tue and £5 for Wed, but I can't work out how to make it keep a running total, or otherwise display a running total on a graph.

    Alternatively, I can add a running total to the original data, but the pivot table then sums this column for each day. Eg, for Monday the running total column displays £10, then £30, which the pivot table sums to £40 for Monday!

    If someone could provide an explanation for how to achieve what I want, or an example with the data set above, I would be very grateful! It seems like it should be easy, but I've been stuck for an hour now!

    Thank you kindly,

    B

  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: How to make cumulative spend chart from pivot

    Hi

    If you'd care to upload your workbook, or at least a representative subset of it then we will have something to work with and can no doubt suggest a solution.
    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
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Hi Richard,

    I have attached a sheet with the sample data. I have input 5 amounts over 3 days, with a running total and put all that data into a Pivot Table. However I'm unable to generate the chart I want from this table.

    I am able to generate a chart that is more-or-less what I want directly from the data, and I have included this, though it has 2 issues. Firstly, it's not dynamic in the way I would want because it's not using the PivotTable. Secondly, it doesn't draw lines between the points in the way it would if there was only a single data entry per day. (eg, it draws a sloped line from £30 to £45, then a vertical line from £45 to £55, because they occur on the same day.)

    Thanks in advance.
    Attached Files Attached Files

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

    Re: How to make cumulative spend chart from pivot

    Change the field setting of 'amount' so that the 'Show values as' is 'Running total in' and the base field is 'Date'.
    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.

  5. #5
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Amazing, thanks. Knew it would be something simple in the end!

  6. #6
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Hmm, it's still not acting quite how I would like, but I'm not sure if this time it's going to be fixable.

    When I extend my data-set, I have a couple of issues with the date axis.

    Firstly, I'm not able to set the bounds of the date. Ideally I would want to set the x axis for a month, even when I only have a week's worth of data.

    Secondly, I would want every day of the month to be on the axis, even if there were no entries in the data-set.

    Example included with an additional entry mid-way through the month, and an example graph showing the correct spacing and x axis running to the end of the month.

    Setting it up the way you advised, the chart skips days that have no entry, and I'm not able to set the date bounds. It's not really treating the date axis as a date, just a list of categories.

    Are either of these possible?
    Attached Files Attached Files

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

    Re: How to make cumulative spend chart from pivot

    I think that about as close as I can come, not to say that there may not be someone out there who can do better, is to put the dates for a month in another column where the first date is typed in* and the the rest are filled by the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    An adjacent column is populated by the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Both of these columns could be hidden for aesthetic purposes.
    A pivot table could then reference the two 'additional' columns and a pivot chart could reference that, as seen in the top chart labeled 'Total'.
    You could run a line chart directly from the data in the two additional columns, as in the bottom chart labeled 'Amount'.
    *If you always want the dates displayed to be for the current month use the following formula, as shown in F1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Hi JeteMc,

    That's certainly closer, though that's probably going to mean too much faffing on the back end, and still doesn't quite give the desired result (when I made the chart without using a Pivot Table, I could extend the axis even with no data present, and then project a trendline into the future, which this doesn't seem to do still).

    eg:
    Capture.PNG

    Part of the reason I'm trying to do this with a Pivot Table is because the actual data has a lot of different columns and totals that I want to be able to easily switch between, so having to introduce even more columns to calculate the data is potentially going to be more hassle than simply manually making the graphs from the source data.

    I really appreciate your last reply though, and I've certainly learned a couple of things from it. I'll carry on fiddling with what you've provided, as it might be that it ends up more useful than what I'm currently working with, so thank you kindly!

    If anyone else has a way to get the desired result, please let me know.

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

    Re: How to make cumulative spend chart from pivot

    I understand that you want to use a pivot table and pivot chart and that you don't want to add columns to what you already have. That said I thought that you might want to take a look at the attached file which has two 'additional' columns compared to the file attached to post #7 and no longer includes a PT option (sorry).
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Wow, those are some impressive formulas! I'm going to have to spend a while looking at this just to understand how they work!

    It looks like the same effect I got just by adding a trend-line though, no?

    I've attached an example similar to what I'm currently using now on my full data-set - Just charting from a running total and projecting a trendline (though mine has square corners, because of the multiple entries for each day.)

    The reason I'm trying to get it with a Pivot Table is because I want to be able to change the chart to show, for example, how much I spent on Lunch, then how much on Dinner, then how much on Food all-together, then how much was on non-essentials, then how much was spent by me vs my partner, then how much was by cash how much by card, and a dozen other variables that I want to be able to combine on the fly.

    At the moment I just picked a handful of permutations that I'm likely to use most often and made each their own chart, but I figured if I could do it with a Pivot Table, it would be much easier. I may have come across one of those things that seems simple, but Excel just doesn't like to quite do the way you want it.
    Attached Files Attached Files

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

    Re: How to make cumulative spend chart from pivot

    I think that this may be getting closer to what you are looking for. On the PT & Chart tab there is a pivot table based on the data on sheet1. The chart on the PT & Chart tab is just a regular line chart, not a pivot chart, based on the pivot table, as opposed to the data on sheet 1 (I hope that makes sense). After choosing to insert a line chart I right clicked inside the chart are and chose 'select data'. I then selected B4:B24, I chose to make a trend line and formatted it. I put the legend at the top. I again selected 'select data' and for the axis label range chose A4:A34. Hope that this is helpful.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    09-14-2016
    Location
    England
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: How to make cumulative spend chart from pivot

    Ooh, pretty good, that's certainly closer in what the final chart should look like.

    The data doesn't pull through right though. The data for the 6th of Jan is displayed as the 4th!

    I might try and go with this for the moment though, and just make sure I don't have any gaps in my data, as it seems to display better than any of the other options so far.

    Thanks again.

    EDIT: I've implemented this with my full data set and it looks great! Thanks
    Last edited by Bglamb; 01-08-2017 at 04:47 PM.

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

    Re: How to make cumulative spend chart from pivot

    Here is a half pivot table half range fed chart where the range is PT dependent so that the whole operation should be filterable as stated in post #10. The pivot table, columns A and B, is getting data from sheet 1, which as you stated above doesn't have gaps. The linest function, which has a dynamic 'Known Ys' range, provides both the slope and intercept for the projections in column C. The dates in column D are displayed along the X axis of the chart.
    Formulas involved - Slope and Intercept*:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Projection (starting with row 5):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dates in column D (starting with row 5):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    A slider filters the data in the pivot table, in this case Lunch and/or Dinner. I am assuming from post #10 that you have already worked out how the other filters are to be applied.
    *See Excel Help for Linest function.
    This should eliminate the need to constantly change the forecast forward value every day.
    I hope this is helpful, it has been fun.
    Attached Files Attached Files
    Last edited by JeteMc; 01-08-2017 at 11:46 PM.

+ 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. Make Pivot Chart Only Show Top Information
    By kaleonard08 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 03-26-2016, 06:08 AM
  2. How do I make a Pivot table/chart with this data?
    By hollyperret in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-02-2015, 11:02 AM
  3. How to present cumulative data using a chart and pivot table
    By Rob (SA) in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 04-29-2014, 06:14 AM
  4. Rearrange data to make pivot chart
    By aqua267 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 02-07-2014, 12:21 PM
  5. Pivot Charts : Dollar spend and hours for month
    By Ktahilramani in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-04-2014, 10:59 PM
  6. Budget v Spend Pivot Table - can this be automated?
    By NicNocs in forum Excel General
    Replies: 6
    Last Post: 10-02-2011, 09:18 AM
  7. [SOLVED] How do I estimate the year spend if spend is $26000 as of May?
    By Felicia Pickett in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-19-2006, 11: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