Forum Discussion
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..
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.
Put your months for your x axis. Then create the calculations and drop them on the chart.
3 Replies
- kcantor
Community Champion
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
Helper II
Hi kcantor,
Thanks for replying.
My data looks like this.
Row Labels201720182019Grand TotalGrand Total241204229674
201701 19 19 201702 29 29 201703 30 30 201704 19 19 201705 18 18 201706 14 14 201707 23 23 201708 17 17 201709 10 10 201710 6 6 201711 36 36 201712 20 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 25 25 201902 29 29 201903 30 30 201904 19 19 201905 18 18 201906 33 33 201907 23 23 201908 17 17 201909 10 10 201910 6 6 201911 13 13 201912 6 6 and my chart comes like this .
But i want the all years in different line. how do i do that.
Thank You.
- kcantor
Community Champion
Put your months for your x axis. Then create the calculations and drop them on the chart.