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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

carry over color for each year in the year legend of a line and clustered column chart

I have a line and clustered column chart which looks as follows (see below, always only showing the latest 3 years). How do I make sure that when the current year goes from 2018 to 2019, that automatically the 2019 data gets the 2018 color, 2018 gets the 2017 color, and 2017 gets the 2016 color? Just making sure that, when we go from 2018 to 2019, the three years get any of below three colors (without specifying which year gets which color) is also acceptable. Thank you.

 

Line and clustered column chart per yearLine and clustered column chart per year

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may add a calculated column to return -2, -1 and 0.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-chuncz-msft,

 

Thank you for your quick response. But how would that work exactly? Because to dynamically change the last 3 years themselves (the numbers), I got that covered by setting a page level filter based on the following calculated column to 1:

 

IsInCurrentOrLastYearOrYearBeforeThatElectricity = 
   IF(YEAR(NOW())=ElectricityTelemetryData[Jaar] || 
      (YEAR(NOW())-1)=ElectricityTelemetryData[Jaar] || 
      (YEAR(NOW())-2)=ElectricityTelemetryData[Jaar]; 
1; 0)

 

 

But the problem is that I don't know how to associate a specific color with these years when the year changes.

 

Thanks again for any help.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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