Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Pooja_D
Partner - Contributor III
Partner - Contributor III

2 Different color in one line chart

Hello Team,

We have prediction data.


I want to show in line chart
1. if month of January 2023 to current month(July 2023) data appear in one color
2. And remaining data for.e.g. Next month is august 2023 to Dec 2023 data should come in another color?

kindly suggest.

Thanks.

Labels (1)
1 Solution

Accepted Solutions
justISO
Specialist
Specialist

Hi, in line chart properties menu, under 'Appearance'->'Colors and legend' choose color 'by expression' and describe condition for your needs, f.e. below is used expression, where 'period' is a date:
if(MonthEnd(period)<=MonthEnd(today()), LightRed(), Green())

justISO_1-1690786114903.png

View solution in original post

4 Replies
justISO
Specialist
Specialist

Hi, in line chart properties menu, under 'Appearance'->'Colors and legend' choose color 'by expression' and describe condition for your needs, f.e. below is used expression, where 'period' is a date:
if(MonthEnd(period)<=MonthEnd(today()), LightRed(), Green())

justISO_1-1690786114903.png

Pooja_D
Partner - Contributor III
Partner - Contributor III
Author

Hello @justISO  

Thanks for reverting.

It's working.

 

Thanks.

gaddeonline
Contributor III
Contributor III

Hi @justISO,

This solution helpful, if we have only one measure in the chart. If we have second measure in the chart and don't want the two colours for the second measure, how do we skip/exclude the second one from the colour expression.

Please refer the below screenshot. The second line shouldn't be impacted.

gaddeonline_0-1695358591890.png

Thanks and Regards

Mahesh Gadde

justISO
Specialist
Specialist

In this case, use Combo chart, not Line chart. Add you dimension and 2 measures. Under each measure here are 'More properties' button and in here you must set both measures as Line and in Primary axis. Additionally, you can set color for each line, not for whole chart:

justISO_0-1695363017306.png