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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
oliverblane
Helper III
Helper III

Show 0 in Line Chart Instead of Joining Gap

Hi, I have some data that looks like the following:

oliverblane_0-1648544584744.png

I am trying to plot this data on a drill-down line chart like the following:

oliverblane_1-1648544645913.png

The aim is to be able to drill down from date, to hour. There are two issues:

1) There is no data for days 26/27, so the line chart joins the lines instead of showing 0. I would like the chart to show 0 for these values. I have tried setting an ISBLANK() check, but this does not solve the issue.

2) When I drill down to hour, the hours are not in order, and not all hours of the day show:

oliverblane_2-1648544813765.png

 

Is there anything I can do to solve these issues?

 

Sample File: Sample File.pbix

1 ACCEPTED SOLUTION

Hi @oliverblane ,

 

Please create another DateTime table with full date range and time range, and then create relationships between your fact table and this new DateTime table. Then use the Date and Hour column from this new DateTime table.

 

For creating DateTime table, please check: 

Creating a Date/Time Table that increases 1 hour on each row using DAX (vahiddm.com).

 

 

Best Regards,

Icey

 

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

11 REPLIES 11
Shri_Pooja
Regular Visitor

Hi @oliverblane , try sorting your chart by X-axis - Ascending. You can find the option when clicked on the ellipses of the chart as below:

Shri_Pooja_0-1648547107414.png

 

 


Did I answer your question?

If yes, please mark the solution as Accepted!

Thejeswar
Resident Rockstar
Resident Rockstar

Hi,

Check the data type of the Hour Column. This sorting issue could be because the Hour column is in a text datatype. Change it to number and it should work.

 

Also there is a property in X-Axis that allows you to change the axis type. Set that to Categorical. That should display all the axis values. Below SS for your reference

Thejeswar_0-1648546898021.png

 

This solved the ordering issue, thank you. But the chart still does not show 0 values for the days that have no data. Is there anything else to try? I can send a sample PBIX if required.

 

oliverblane_0-1648551074737.png

 

Hi @oliverblane ,

Were you able to replace BLANKS() with 0s?

I doubt, if you don't have entry for all Dates and hours with BLANK as data, this replacing might not help.

May be if you can share a pbix file with some sample data that shows the issue, it might help for helping solve this

 

Regards,

Hi @Thejeswar, thanks for your help here. Unfortunately I am still unable to get this to work.

 

Here is a sample file demonstrating the issue I am having: Sample File.pbix

Hi @oliverblane ,

You can check the below link. Looks like a similar ask. 

https://community.powerbi.com/t5/Desktop/Line-graph-draws-line-even-when-there-s-no-data/td-p/53405

 

Regards,

Unfortunately I could not get this to work. In the attached file you see the gaps still remain where there should be 0. I think as you mentioned the issue is due to my table not having rows for every date.

oliverblane_0-1648625986525.png

Do you know of any way round this?

Hi @oliverblane ,

 

Please create another DateTime table with full date range and time range, and then create relationships between your fact table and this new DateTime table. Then use the Date and Hour column from this new DateTime table.

 

For creating DateTime table, please check: 

Creating a Date/Time Table that increases 1 hour on each row using DAX (vahiddm.com).

 

 

Best Regards,

Icey

 

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

This solution works perfectly, thank you @Icey!

mh2587
Super User
Super User

Measure = IF(SELECTEDVALUE('Table'[value])<>BLANK(),SELECTEDVALUE('Table'[value]),0)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi @mh2587, thanks for your reply. Unfortunately this did not work, do you have any other suggestions? Please see attached sample file: Sample File.pbix

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.