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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
calloni
Helper I
Helper I

Line graph with 2 colors

Hello

I have this table and I need to graph it as a line chart where I have a continuous line that will have 2 colors depending on the Line color column definitions:

 

DateY axisLine color
6/29/20171Gray
5/2/20181Gray
11/3/20221Gray
7/11/20241Orange
11/3/20241Orange

 

Note: I am using the Y axis dummy value as 1 just to make the line straight.

 

However when I use the line chart option in Power BI I get two lines that don't connect to each other:

 

calloni_0-1721069981540.png

 

I wonder what is wrong on my data model that is generating this break in the line?

 

What would it be the options to adjust this?

Thanks in advance

Rodrigo

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @calloni 

**"The "gap" in your data is created because the data is not continuous once you split it into 2 lines. The gray line ends before the orange line starts.

If you want to get a graph like the one in the picture where the gray line is present until the orange line starts, you can artificially create it with 2 measures.

Ritaf1983_0-1721102325586.png

Grey = sum('Table'[Y axis])
orangeline_ = CALCULATE(sum('Table'[Y axis]),'Table'[Line color]="orange")
Ritaf1983_1-1721102423680.png

The pbix is attached

Ritaf1983_2-1721102464450.png

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @calloni 

**"The "gap" in your data is created because the data is not continuous once you split it into 2 lines. The gray line ends before the orange line starts.

If you want to get a graph like the one in the picture where the gray line is present until the orange line starts, you can artificially create it with 2 measures.

Ritaf1983_0-1721102325586.png

Grey = sum('Table'[Y axis])
orangeline_ = CALCULATE(sum('Table'[Y axis]),'Table'[Line color]="orange")
Ritaf1983_1-1721102423680.png

The pbix is attached

Ritaf1983_2-1721102464450.png

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
mickey64
Super User
Super User

For your reference.

Step 0: I use this data table below.  (I add 2 rows to the table.)

mickey64_1-1721100642759.png

 

Step 1: I make a line graph.

mickey64_0-1721100602633.png

 

Thanks... I will go with Ritaf solution for this one as I dont need to change the data as you are proposing... but this made me understand that this is basically overlapping 2 bars to make it work which is really scary 😄

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.