Forum Discussion

peternguyen2's avatar
peternguyen2
Frequent Visitor
1 year ago
Solved

Line Chart appears non-continuous

Hi All,

I have a dataset named OrderWeight in Power BI, and I want to create a line chart based on the following:

  • Order on the X-axis

  • NetWeight on the Y-axis

  • Line (which contains three categories: Line1, Line2, and Line3) used as the Legend in the Power BI visual.

The columns in the dataset do not contain any null or blank values.

Why do the lines not display continuously?

Please see the attached screenshot.

 



12 Replies

  • Hi peternguyen2 ,

    The reason your line chart in Power BI appears non-continuous, with breaks or disconnected points for each line (Line1, Line2, Line3), is due to how Power BI plots the data when the X-axis (Order) contains categorical values and not every Line has a value for every Order.

     

    Here’s what’s happening:

    • Disjointed Lines: In your dataset, each Order is processed on only one Line (i.e., each Order is associated with only one Line, not all three). This means that, for each unique Order value on the X-axis, only one of Line1, Line2, or Line3 has a corresponding NetWeight value; the other two Lines have no data for that Order.

    • Missing Data Points: Power BI expects a continuous sequence of data points for a “continuous” line. When data is missing (i.e., for a particular Order, there is no NetWeight for some Lines), Power BI leaves a gap in the line, making it appear non-continuous or segmented.

    How to Fix or Improve the Chart:

    1. Data Structure: If you want continuous lines, you would need a data structure where each Order has a value (even if it’s blank or zero) for every Line. This would result in a “step-like” chart, but it would make the lines technically continuous.

    2. Alternative Visualization: If your process is such that only one Line processes each Order, a line chart may not be the best visual. A scatter plot with connecting lines or a combination of a scatter and line chart might better represent your data, or you could use a stacked column/bar chart if your focus is comparing NetWeight by Line.

    3. Show as-is: If you want to keep the current chart, just be aware that the non-continuous lines are a direct result of your data’s structure—there are simply no NetWeight values for Line1 and Line2 for Orders handled by Line3, etc.

  • Hello,

    I think with that type of chart you can't tell a story from the structure of your data ... can you please just tell what story you what to present with that data because it looks like you are doing comparison of weight by line but not trend so choose you chart wisely?

  • peternguyen2 Hello,
    Kindly follow below steps to resolve your issue.

    STep 1 - If you're using a measure then you can use COALESCE or IF Logic.
    example -
    samplemeasure = COALESCE(SUM(OrderWeight[NetWeight]), 0)

    this will avoid gap in your data and it will auto fill 0 in case of missing value.

    STep 2- Change in chart setting
    format -> x axis setting -> show item with no data to on
    Set Type to Categorical instead of Continuous

    Thanks

    Harish KM

    Please accept this as a solution if this solves your problem and give kudos as well.



    • peternguyen2's avatar
      peternguyen2
      Frequent Visitor

      Thank you for your solution. I have tried by did not work

  • mussaenda's avatar
    mussaenda
    Community Champion

    Hi peternguyen2 ,

     

    The line is not continuous because you have a legend line1, line2, line 3 which separates them.

    If you will remove the legend, it will be continuous.

     

     

  • Hi peternguyen2 

     

    That behavior is expected because using a column in the legend splits the values into separate groups, preventing any overlap. Some possible workarounds, though not ideal:

     

    - Conditionally formatting a column chart prior to converting it to a line chart

    Please see this vlog - https://youtu.be/3WXwIC8j6Y8?si=r54rttQmD8NxLwBY

    -Use mutiple measures: one for each legend value and another one that isn't filtered down to a legend value.

    In both approaches, however, the legends are separate from the line chart visual itself. The first approach relies on conditional formatting, so no legends are displayed. The second approach uses four separate measures, resulting in an additional legend that must be hidden.

     

    Please se the attached pbix.

  • v-hjannapu's avatar
    v-hjannapu
    Community Support

    Hi peternguyen2,
    I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.

    Regards,
    Harshitha.

  • peternguyen2's avatar
    peternguyen2
    Frequent Visitor

    Hello Community,
    My apologies for the confusion.

    I was trying to display continuous lines for each category (Line1, Line2, and Line3).
    I noticed that when I replace the Order column with ProductionDate, the line chart appears continuous, as shown in the attached screenshot.

    However, my business users want the X-axis to show Order. I’ve tried different approaches, but it’s not working.

    Could you please help me?

    Thank you in advance.

     

     

      • v-hjannapu's avatar
        v-hjannapu
        Community Support

        Hi peternguyen2,

        Just checking in to see if you had a chance to follow up on our earlier conversation. If you're still encountering the issue, please share the sample data so we can assist you with an accurate solution.

        If you have any further questions, feel free to reach out anytime.

        Regards,
        Harshitha.