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 August 31st. Request your voucher.

Reply
Lonefish
New Member

Line graph draws line even when there's no data

I'm using Power BI to draw linegraphs of current measuring over time. There are however gaps in our data. Is it possible to delete te graph line where there's no data?

 

 

As you can see left and right there's data, but the blue (epic paint skills) part has no data. Is it possible that the line isn't there in big gaps?

1 ACCEPTED SOLUTION
KGrice
Memorable Member
Memorable Member

I can't find a setting for it, and even forcing the measure to return BLANK when there is a 0 or no data doesn't do it. Some possible workarounds:

 

1. Change the X-Axis type to Categorical instead of Continuous. Dates without data won't show on the chart, but the downside is it's not obvious that any dates are missing, since they're all spaced equally without gaps.

2. Use a column chart instead. The gaps in data will show this way. If you still want a trend line, you can use the "Line and stacked column chart" and put the measure you want as both a line and column. Format the column color (under Data colors > Default Column Color) as something unobtrusive. You'll at least have a visual indication that there is no data if there is no bar, and you can see the line for trending.

3. Set your measure to return 0 for nulls. This will actually plot a 0, which could be really bad depending on your dataset. Don't want to confuse it with real values of 0 as opposed to gaps. But if it makes sense for your dataset, it makes the gap line up with the axis and is almost the same as not being there at all. Maybe even set it to -1 if you could have actual 0 amounts but not negative numbers in your data.

 

This sounds like a good candidate for an idea. Some kind of switch in the settings of a line chart for how to handle plotting nulls or 0s. All of the above options could cause confusion for users.

View solution in original post

6 REPLIES 6
Ankita_Sunil
New Member

Hi all,

 

I just found a workaround. I wrote a dax for a calculated column as below.

 

column = if(isblank(data[Temperature]),0,data[Temperature])

 

Then I plotted the time (x axis) vs data[Temperature] & data[column] (y axis) line chart. Changed the color of data[column] line to white and kept its transperancy to 100. Serves the purpose.

 

Ankita_Sunil_0-1746276780359.jpeg

 

Hi everyone,

 

I'm posting from a new account, as I unfortunately lost access to my previous one, not sure how or why.

 

A better solution for this scenario is to create a DateTable as:

 

Date_Table = SELECTCOLUMNS(CROSSJOIN(CALENDAR(min(Main_Data[TIMESTAMP]), max(Main_Data[TIMESTAMP])),GENERATESERIES(TIME(0,0,0), TIME(23,30,1),TIME(0,30,0))),"DateTime", [Date] + [Value])

 

Next, create a measure as:

 

Temp=0

 

Then, create a relationship between Date_table and the Main_Data[TIMESTAMP] column. Use the DateTime column from the Date_Table for plotting (X-axis), and set the X-axis type to Categorical. Add Temp along with main data in the value section (Y-axis). Change the colour of the Temp line to match the background and hide the series. Also, take care of the tooltip either by hiding it or creating a custom tooltip.

 

AnkitaSunil_0-1746953484978.png

 

Hope this helps!

sudhakarsha
Regular Visitor

Simply apply the filter on the Line chart to show Non-blanks. That will exclude all the dates without value.

Hi do you know if there is any current solution for this? I am stucked on a business requirement on this feature

cyclist007
Responsive Resident
Responsive Resident

Hi,

 

Did you find a solution to this or a better way to handle this? 
I also need a contiuous line chart (categorical does not help), and cant just plot the value as zero since its temperature (and actual value hovers around zero)

KGrice
Memorable Member
Memorable Member

I can't find a setting for it, and even forcing the measure to return BLANK when there is a 0 or no data doesn't do it. Some possible workarounds:

 

1. Change the X-Axis type to Categorical instead of Continuous. Dates without data won't show on the chart, but the downside is it's not obvious that any dates are missing, since they're all spaced equally without gaps.

2. Use a column chart instead. The gaps in data will show this way. If you still want a trend line, you can use the "Line and stacked column chart" and put the measure you want as both a line and column. Format the column color (under Data colors > Default Column Color) as something unobtrusive. You'll at least have a visual indication that there is no data if there is no bar, and you can see the line for trending.

3. Set your measure to return 0 for nulls. This will actually plot a 0, which could be really bad depending on your dataset. Don't want to confuse it with real values of 0 as opposed to gaps. But if it makes sense for your dataset, it makes the gap line up with the axis and is almost the same as not being there at all. Maybe even set it to -1 if you could have actual 0 amounts but not negative numbers in your data.

 

This sounds like a good candidate for an idea. Some kind of switch in the settings of a line chart for how to handle plotting nulls or 0s. All of the above options could cause confusion for users.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Kudoed Authors