cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Always Show Last 24 Hours on Line Chart When Data Starts with NULLS

Hello,

 

I am making a line chart on a continous time-based axis.  I am using the relative time filter to show only the data in the last 24 houts.  When the range starts with NULL values, my x-axis does not go back the full 24 hours.   Instead, it only goes back to the first value and starts the chart from there.  For example, if I have 3 hours of NULL values to start my last 24 houts, then the x-axis only shows the last 21 hours.  How can I make the x-axis always show the full 24 hours even if the daa occasionally starts with NULL values?  I have selected the option to "show items with no data" but that didn't do anything.

 

Thnaks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @stalerik ,

 

The tpye of the X axis should be 'Categorical' and enable 'Show items with no data'.

v-lionel-msft_0-1599461982982.png

v-lionel-msft_0-1599462156976.png

 

v-lionel-msft_1-1599462182466.png

 

Best regards,
Lionel Chen

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

 

 

 

View solution in original post

5 REPLIES 5
Super User IV
Super User IV

@stalerik Generally you do that like this:

Measure =
  VAR __Calc = <some calculation>
RETURN
  IF(ISBLANK(__Calc),0,__Calc)

Alternatively:

Measure =
  VAR __Calc = <some calculation>
RETURN
  __Calc + 0

 


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Super User IV
Super User IV

@stalerik , You can add +0 to your measure, that will create left join.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Thank you for this information.  The new measure converts all the NULLS to zeros and then puts the zeros on the chart.  This does extend the x-axis to the full 24 hours but now it shows zeros on the line chart.  Is there another way to show the full 24 hours on the x-axis but leave the NULL values as missing on the chart and tooltip?  I don't want to give the impression that an actual zero value is in the data, but instead show the values as missing (gap).

I've got a little workaround for this, but it's quite bad since i cant figure out how to fix the tooltip 🙂 

But if you're fine with removing the tooltip and using datalabels instead it should work quite well! 

See the attached file. 

/ J


Connect on LinkedIn

Hi @stalerik ,

 

The tpye of the X axis should be 'Categorical' and enable 'Show items with no data'.

v-lionel-msft_0-1599461982982.png

v-lionel-msft_0-1599462156976.png

 

v-lionel-msft_1-1599462182466.png

 

Best regards,
Lionel Chen

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

 

 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors