Forum Discussion
Anonymous
6 years agoNot applicable
Line Graph Conditional Formatting
Hi, I was wondering if there was a way to color code a line graph. I looked it up, and on some versions of Power BI, there is either an advanced option on the Data colors editor, or 3 vertical dots ...
MFelix
6 years agoSuper User
Hi jthomson ,
Condittional formatting is not possible on line charts.
What you can do is use measure to calculate the higher and lower and then for those measure place markers with different colours and hide the line.
What I did was to create 5 measures:
Current Year = SUM('Table'[Value])
Previous Year = CALCULATE(SUM('Table'[Value]);DATEADD('Calendar'[Date];-1;YEAR))
Previous 2 year = CALCULATE(SUM('Table'[Value]);DATEADD('Calendar'[Date];-2;YEAR))
Higher = IF([Current Year]<[Previous Year];BLANK();[Current Year])
Lower = IF([Current Year] < [Previous Year];[Current Year];BLANK())
Then place the measures on the line chart and final result will be this one (colors are not the best ones):
I also used a calendar table and a slicer to select the year.
Check PBIX file attach.
Anonymous
6 years agoNot applicable
I feel like I am close, but I am not sure how to encorperate the Red and Green dots if it is above or below last years totals...
- MFelix6 years agoSuper User
Hi Anonymous
You need to go to the line chart options:
- Shapes
- Customized series
- Select the higher and lower
- Line size 0
- Show Marker on
- Select the marker and color to your liking
- Anonymous6 years agoNot applicable