Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
1 year ago
Solved

Cropped Graph (Line Graph)

Hello everyone

Am laboring in one graphic of lines in Power BI y Need help for avoid what the line Connect Of Periods of data when there's one rank of Dates without data. A continuation Detail Is it problem:
I have a chart called Energy with the following relevant columns:
  • DATE (type Date, e.g. "02/04/2025")
  • TIME (type Time, e.g., "00:00:00")
  • Consumo_Energia (numerical values)
  • Refrigerator (refrigerator brand LG, SAMSUNG,MABE, ETC),
My goal is to create a line graph that shows the average of consumo_energia by DATE_TIME (a combination of DATE y TIME), I have dates from March 19, 2025 from 6:00 PM to April 28 at 5:00 PM. The important thing is that I don't have the dates from my source Excel file between April 2nd and April 15th. That's why when I graph I get a straight line that connects the dates where there is no data, I don't want it to appear that way but to go continuously. (Obviously the X axis is selected in continuous but I still get this line).
Thank you for the support.
Example of how to connect the dates that I don't have in my source file:

  • Hi Syndicate_Admin 

     

    Three options for you >

     

    I have created a video on this as well https://youtu.be/n6kEXZjQ5f0

     

     

    Enhancing Data Representation in Power BI Line Charts

    1. Categorical X-Axis for Controlled Spacing – Switching the X-axis type from Continuous to Categorical ensures missing dates don’t get connected. However, this method spaces out all dates equally, making it less obvious when gaps exist in the dataset. 

       

     

    1. Use a Column Chart for Visible Gaps – If showcasing gaps is important, opt for a Column Chart, which naturally displays missing data points. If a trend line is still needed, the Line and Stacked Column Chart can be used. Adjust the Default Column Color to something subtle, ensuring missing data is visually distinguishable while keeping the trend intact.

     

     

     

    1. Handle Null Values in Measures Carefully – Setting a measure to return 0 for nulls forces data points onto the axis, but this might create misleading results if real zero values exist. To distinguish true data gaps, consider using -1 instead (assuming negative values don’t naturally occur), ensuring gaps align properly with the axis without affecting actual metrics.

     

     

    This solution is the best one > Solved: Line graph draws line even when there's no data - Microsoft Fabric Community 

     

    Regards,

    Ritesh

    Community Champion

    Please mark the answer if helpful so that it can help others

    Dance-Sing with Data Projects - YouTube

  • Hi Syndicate_Admin ,

    Thank you for providing such a clear and helpful explanation ribisht17 . 

    1. Using a Categorical X Axis to prevent the line from connecting over missing dates
    2. Switching to a Column Chart to make those gaps more noticeable
    3. Handling null values in measures by using something like -1 to identify real data gaps without confusing them with actual zeros.

    Could you confirm if ribisht17 , solution worked for you? If it did, please mark the answer as 'Accept as Solution' so others with similar queries can find it more easily. If not, please share the details. 

    Thank you for your response danextian & Deku .

     

     If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

     

7 Replies

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi Syndicate_Admin ,

    Thank you for providing such a clear and helpful explanation ribisht17 . 

    1. Using a Categorical X Axis to prevent the line from connecting over missing dates
    2. Switching to a Column Chart to make those gaps more noticeable
    3. Handling null values in measures by using something like -1 to identify real data gaps without confusing them with actual zeros.

    Could you confirm if ribisht17 , solution worked for you? If it did, please mark the answer as 'Accept as Solution' so others with similar queries can find it more easily. If not, please share the details. 

    Thank you for your response danextian & Deku .

     

     If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

     

  • Deku's avatar
    Deku
    Super User

    You could have two separate lines, one for each period. You could either define each period in a column and add to the legend. Or can create a measure for each period.

  • You will need to set your x-axis to Categorical. If you use Continuous, Power BI will try to fill in the gaps even when some dates are missing.

  • Hi Syndicate_Admin 

     

    Three options for you >

     

    I have created a video on this as well https://youtu.be/n6kEXZjQ5f0

     

     

    Enhancing Data Representation in Power BI Line Charts

    1. Categorical X-Axis for Controlled Spacing – Switching the X-axis type from Continuous to Categorical ensures missing dates don’t get connected. However, this method spaces out all dates equally, making it less obvious when gaps exist in the dataset. 

       

     

    1. Use a Column Chart for Visible Gaps – If showcasing gaps is important, opt for a Column Chart, which naturally displays missing data points. If a trend line is still needed, the Line and Stacked Column Chart can be used. Adjust the Default Column Color to something subtle, ensuring missing data is visually distinguishable while keeping the trend intact.

     

     

     

    1. Handle Null Values in Measures Carefully – Setting a measure to return 0 for nulls forces data points onto the axis, but this might create misleading results if real zero values exist. To distinguish true data gaps, consider using -1 instead (assuming negative values don’t naturally occur), ensuring gaps align properly with the axis without affecting actual metrics.

     

     

    This solution is the best one > Solved: Line graph draws line even when there's no data - Microsoft Fabric Community 

     

    Regards,

    Ritesh

    Community Champion

    Please mark the answer if helpful so that it can help others

    Dance-Sing with Data Projects - YouTube

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi Syndicate_Admin ,

    Has your issue been resolved, or do you require any further information? Your feedback is valuable to us. If the solution was effective, please mark it as 'Accepted Solution' to assist other community members experiencing the same issue.

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi Syndicate_Admin ,

    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

    Thank you.

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi Syndicate_Admin ,

    Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.

     

    Thank You.