+ Reply to Thread
Results 1 to 7 of 7

Year on Year Line Chart

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Durham
    MS-Off Ver
    2010
    Posts
    9

    Year on Year Line Chart

    Hi,

    How would I create a year on year line chart (Each date) with the lines crossing over each other to show a year on year comparison.

    I've attached an example showing the format I've got the data in.

    Thanks,
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Year on Year Line Chart

    Here's how I did it. I'm not sure if I like it, but it was really quick and easy to do.

    1) Select a cell in the raw data -> Insert -> Pivot Table
    2) Drag "Date" to the row labels field and "Data A" to the sum values field.
    3) Select a cell in the pivot tables "row columns" column -> Pivot table tools -> options -> Grouping selection (or right click -> Group). Select Days and Years for the groups. Note the addition of "years" to the available fields in the Pivot table field list.
    4) Drag the newly appeared "years" to the column labels field.
    5) Select the pivot table (if needed) and insert -> line chart.

    There you have a year over year line chart. Does that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    07-28-2014
    Location
    Durham
    MS-Off Ver
    2010
    Posts
    9

    Re: Year on Year Line Chart

    Hi,

    Thanks for this.

    The issue with this is that it seems to group 2017 and 2018 in the 2018 field rather than showing just 2018

    Would there be another way to do it that would be a little more visually appealing in? Would it work if the data was in a different format?

    Thank you again for your help, I really appreciate it.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Year on Year Line Chart

    I don't know why your version of Excel combined 2017 and 2018 for the later months like it did. When I create from scratch, my 2018 line terminates at the "blanks" in the later months of 2018.

    I am sure there is a different, "more visually appealing" way to do this. It probably depends on what you think is going to be more visually appealing. What do you have in mind?

    Off the top of my head, the approach to something that doesn't go through a pivot table would involve some helper columns on the raw data page. A YEARFRAC() function to convert the date serial numbers to fraction of a year. Then an IF() function to place the data into year based columns. In an approach like this, D2 =YEARFRAC(DATE(YEAR(A2),1,1),A2)
    E2=IF(YEAR(A2)=E$1,$B2,NA()) where E1 contains 2017.
    Copy E2 into F2 and place 2018 into F1.
    Copy D2:F2 down as far as needed.
    Use these helper columns to create a scatter chart.

    This should look exactly the same as the pivot table/chart approach (with different values on the X axis). As noted, I don't know why your pivot table chose to blend 2018 and 2017 when 2018 did not have data. Again, making this more "visually appealing" depends on what you think will make this more visually appealing.

  5. #5
    Registered User
    Join Date
    07-28-2014
    Location
    Durham
    MS-Off Ver
    2010
    Posts
    9
    Hi,

    I think the pivot table option might do the trick.

    If I had data a,b,c,d, etc woild creating the pivot table be the same?

    So i would be looking to create the pivot table with the datw column and all the data columns and then create line charts for each data column. E.g date + data a, date + data b, etc.

    Thanks

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Year on Year Line Chart

    I am not an expert on pivot tables, but it seems like it should be the same basic idea. It is not clear to me if you are wanting multiple pivot tables/charts for each data type or if you are trying to combine this all into a single chart. About all I can suggest at this point is to create a few pivot tables/charts and try different things to see what you can get them to do.

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Year on Year Line Chart

    First issue, is that you have stacked line chart and not line chart.

    Here's how to clean it up...

    1. Delete your current chart.

    2. Refresh Pivot Table.

    3. Recreate Days & Years grouping. Make sure you group it in one shot for both. This will reset Years from column to row field.

    4. Move Years back to column field.

    5. Add PivotChart, making sure that you select line chart and not the stacked line chart.

    See attached.
    Attached Files Attached Files
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ 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. Year on year pivot chart when dates go horizontal?
    By mra1984 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 04-25-2018, 10:44 AM
  2. [SOLVED] How to chart year-year comparison when data is in different worksheets
    By Bloodrule in forum Excel General
    Replies: 17
    Last Post: 02-15-2018, 02:39 AM
  3. Chart to compare bi weekly amount, this year vs last year
    By sleepyjim in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-31-2016, 05:57 AM
  4. Replies: 0
    Last Post: 11-23-2012, 01:27 AM
  5. Replies: 3
    Last Post: 12-30-2010, 07:24 AM
  6. How to compare current year to prior year in bar chart?
    By substring in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-12-2005, 02:06 PM
  7. Compare values year to year in a line graph
    By Purdue02 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-04-2005, 02:28 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