Forum Discussion
Jeremy19
5 years agoHelper III
Line chart with different colours
Hi, It is possible to have a line that changes color according to a categorical variable? I have 3 columns (Time, Value and TeamId). I wish to have the line which is the color of the team at this ti...
mahoneypat
5 years agoMicrosoft Employee
You can make a measure like this that you can use as the data color.
Line Color = SWITCH(MIN(Table[TeamID]), "Team A", "Red", "Team B", "Blue", "Black")
Then here's the trick that Reid Havens has a video about here - https://www.youtube.com/watch?v=2_2rGxA6PKQ
First make it a bar chart, use this measure in the fx button for the data color, then switch the chart to a line chart. The line chart by default doesn't have the option to use a color measure but this is a workaround.
Regards,
Pat