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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to color line chart in power bi

Hello All,

 

I have a line and stacked column chart where I am showing sales in bar and porfit in line and I need to color the line based on profit.

Is it possible in Power Bi ?

 

Could any one please help

1 ACCEPTED SOLUTION
PC2790
Community Champion
Community Champion

Hey @Anonymous ,

 

I found this interesting thread that states a way of formatting the line according to conditions. You can see if it works out for you.

I even tried it using my data and it is working for me to some extent.

PC2790_0-1653042602710.png

 

 

View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

Can you provide sample data and a depiction of the expected outcome?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi @PaulDBrown ,

 

Below is my sample data

 

Date               Sales        Profit

1/1/202110010
1/2/202120020
1/3/202130030
1/4/202140040
1/5/202150050

 

 

I took a line and clisutered column and chart and put sales column values and porfit in line values.

Now I need chnage the color of the line for each date based on the porfit values.

if profit is lesstahan 30 then itb should be red else green

PC2790
Community Champion
Community Champion

Hey @Anonymous ,

 

I found this interesting thread that states a way of formatting the line according to conditions. You can see if it works out for you.

I even tried it using my data and it is working for me to some extent.

PC2790_0-1653042602710.png

 

 

Hi, @PC2790 

You appear to be plotting the original line chart in two parts with different colors, right?

greater than 30 = IF(CALCULATE(SUM('Table'[value]))>=30,CALCULATE(SUM('Table'[Sales])),BLANK())
less than 30 = IF(CALCULATE(SUM('Table'[value]))<30,CALCULATE(SUM('Table'[Sales])),BLANK())

Surprised, didn't expect to achieve the same effect without conditional formatting.

I have learned a lot. Thanks for your sharing.

 

Best Regards,
Community Support Team _ Eason

Hi, @Anonymous 

You can do the same for other graphs like bar and column chart.

However, it is not possible in line chart. You can't set multiple colors for a line chart. A line chart can only correspond to one color. Conditional formatting doesn't work here either.

But you can add a constant line to ‘Line Values’ to facilitate analyzing the data.

constant line= 30

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.