Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Color code Multiple lines in a single chart

Hello All,

 

I have a chart where I am showing my NPS for 3 locations with multiple lines in a single line chart.

Locations are India,USA and Canada

So I am using diffeent shapes here for each line .(star,rectangle and square)

 

Now my requirement is I need to change my 3 line colors based on nps score.

So if nps is morethan 90 it should be green and lessthan 90 it should be red.

 

is it possble ?

 

Could anyone please suggest how to do this for all 3 lines in the chart.

 

  • Hi Anonymous ,

     

    For the line chart, each line can only display one color (which can be customized), but it is not possible to specify the color of a line segment based on a conditional judgment. This is mainly different from legends, which can cause color conflicts. But similar to table visual, you can set the color under different conditions by customizing the condition. Reference as follows.

    M =
    IF (
        MAX ( 'Table'[Value] ) > 90,
        "green",
        IF ( MAX ( 'Table'[Value] ) < 90, "red", "yellow" )
    )

     


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

Replies have been turned off for this discussion
  • Hi Anonymous ,

     

    That should be possible with conditional formatting. Can you please post a sample data that we can easily manipulate as well as a screenshot of your chart?

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    For the line chart, each line can only display one color (which can be customized), but it is not possible to specify the color of a line segment based on a conditional judgment. This is mainly different from legends, which can cause color conflicts. But similar to table visual, you can set the color under different conditions by customizing the condition. Reference as follows.

    M =
    IF (
        MAX ( 'Table'[Value] ) > 90,
        "green",
        IF ( MAX ( 'Table'[Value] ) < 90, "red", "yellow" )
    )

     


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.