Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mahadevaraobc
Helper II
Helper II

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..

2 ACCEPTED SOLUTIONS
kcantor
Community Champion
Community 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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

@Mahadevaraobc 

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
kcantor
Community Champion
Community 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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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 .

Untitled.png

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

 

Thank You.

@Mahadevaraobc 

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.