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 September 15. Request your voucher.

Reply
klehar
Helper V
Helper V

Conditional Formatting a Line Chart in Power BI

I'm not sure if this is possible in Power BI, but want to try workarounds

 

My requirement:

For my data given below, I want to color Actuals with a different color and my Non Actuals with a differnt color on a line chart.

DateValueType
1/1/2021100Actuals
1/2/2021200Actuals
1/3/2021300Actuals
1/4/2021400Actuals
1/5/2021500Actuals
1/6/2021640Forecast 1
1 ACCEPTED SOLUTION

You can use two measures instead of conditional formatting: one measure for Actuals and the other for the Forecast values (this measure must include the actual values to avoid the blank space in the chart). so:

Actuals = SUM(Table [Actuals]
Forecast = SUM(Table [Forecast]) + [Actuals]

 

Place both measures in the values bucket and then format each measure to your liking:
shade.jpg

 





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.






View solution in original post

7 REPLIES 7
Pragati11
Super User
Super User

Hi @klehar ,

 

Is this what you are looking for?

Pragati11_0-1646234393862.png

There are only categories under Type column: Actuals and Forecast1

I have moved them to the LEGEND section of the line chart visual.

Forecast1 just has one row in your sample data therefore it is shown as a dot.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi @Pragati11 sorry to biggie back on this but it kinda aligns.

 

I have a date axis, 1 line in my line graph and able to see forecast in my analytics.  However it displays pff and is greyed out.  Any logic to this? 

 

KDGJR_1-1646246372997.png

Hi @Anonymous ,

 

 Not sure if this is the right thread for you to post your question as i is not related to the question of the original thread.

Can you please create a new thread for your question? In this way you are not taking over other person's thread.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

klehar
Helper V
Helper V

@PaulDBrown tagging you since you have context

Here are two options:

1) Since the default line chart doesn' allow conditional formatting, you can hack it by creating a bar chart first, adding the conditional formatting and then changing it to a line chart.

I've created this measure to format the chart:

 

Line Colour = IF(MAX('Table'[Filter/Type]) = "Actuals", 1, 2)

 

format.gif

 2) Use two measures for the line chart. The measure you already have for the forecast and another for "Actuals"

 

Actuals = CALCULATE([Sum Value],'Table'[Filter/Type] = "Actuals")

 

Add both measures to the Values bucket and then format each meaure to your liking:

Inkedline chart_LI.jpg

 





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.






@Pragati11 @PaulP 
While your bar chart solution is quite intuitive, I'm using first the traditional line chart solution

However I get a gap and want the lines to be joined on my actual dataset.

klehar_0-1646288397644.png

If this doesn't work I'll like to try the bar chart approach.

However what measure should i use in the bar chart in the value column, since conditional formatting requires me to have only 1 value.

@PaulDBrown 

 

 

You can use two measures instead of conditional formatting: one measure for Actuals and the other for the Forecast values (this measure must include the actual values to avoid the blank space in the chart). so:

Actuals = SUM(Table [Actuals]
Forecast = SUM(Table [Forecast]) + [Actuals]

 

Place both measures in the values bucket and then format each measure to your liking:
shade.jpg

 





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.






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors