Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Solved! Go to Solution.
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.
Can you provide sample data and a depiction of the expected outcome?
Proud to be a Super User!
Paul on Linkedin.
Hi @PaulDBrown ,
Below is my sample data
Date Sales Profit
1/1/2021 | 100 | 10 |
1/2/2021 | 200 | 20 |
1/3/2021 | 300 | 30 |
1/4/2021 | 400 | 40 |
1/5/2021 | 500 | 50 |
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
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.
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
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
71 | |
70 | |
38 | |
27 | |
26 |
User | Count |
---|---|
97 | |
96 | |
59 | |
44 | |
40 |