Forum Discussion

Mahadevaraobc's avatar
Mahadevaraobc
Icon for Helper II rankHelper II
7 years ago
Solved

Multiple year line in single line chart

Hi All,

I have a column in yyyymm format, i have converted this to month format.

How do i display multiple year as different line in single line chart? when i try to add year to legend field is shows 1 single line for all year but not different line.

 

Thank you in advance..

  • Mahadevaraobc 

    You will need to create different calculations for each year to display the way you request.

    This Year Sales = SUM(FactTable[LineSales])

    Last Year Sales = CALCULATE([This Year Sales], DATEADD(Date[DateKey], -1, year))

    2 Yr Prior Sales = CALCULATE([This Year Sales], DATEADD(Date[DateKey], -2, year))

    Then drop these as measures on the visual using your date table month column for the axis.

    If I have misunderstood your question, please provide some sample data and more information on the solution you are hoping to see.

  • kcantor's avatar
    kcantor
    7 years ago

    Mahadevaraobc 

    Put your months for your x axis. Then create the calculations and drop them on the chart.

3 Replies

  • kcantor's avatar
    kcantor
    Icon for Community Champion rankCommunity Champion

    Mahadevaraobc 

    You will need to create different calculations for each year to display the way you request.

    This Year Sales = SUM(FactTable[LineSales])

    Last Year Sales = CALCULATE([This Year Sales], DATEADD(Date[DateKey], -1, year))

    2 Yr Prior Sales = CALCULATE([This Year Sales], DATEADD(Date[DateKey], -2, year))

    Then drop these as measures on the visual using your date table month column for the axis.

    If I have misunderstood your question, please provide some sample data and more information on the solution you are hoping to see.

    • Mahadevaraobc's avatar
      Mahadevaraobc
      Icon for Helper II rankHelper II

      Hi kcantor,

       

      Thanks for replying.

      My data looks like this.

      Row Labels201720182019Grand TotalGrand Total241204229674

      20170119  19
      20170229  29
      20170330  30
      20170419  19
      20170518  18
      20170614  14
      20170723  23
      20170817  17
      20170910  10
      2017106  6
      20171136  36
      20171220  20
      201801 19 19
      201802 29 29
      201803 30 30
      201804 19 19
      201805 18 18
      201806 14 14
      201807 23 23
      201808 17 17
      201809 10 10
      201810 6 6
      201811 13 13
      201812 6 6
      201901  2525
      201902  2929
      201903  3030
      201904  1919
      201905  1818
      201906  3333
      201907  2323
      201908  1717
      201909  1010
      201910  66
      201911  1313
      201912  66

       

      and my chart comes like this .

      But i want the all years in different line. how do i do that.

       

      Thank You.

      • kcantor's avatar
        kcantor
        Icon for Community Champion rankCommunity Champion

        Mahadevaraobc 

        Put your months for your x axis. Then create the calculations and drop them on the chart.