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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Represent null data as zero in line chart

Hello, 

 

I'm building a line chart that represents the evolution of the count of some Value (y axis) depending on levels. As you can see: 

 

- The x axis starts in February 2021, with Value=3 in level 0 (thus, there are three items with value 0). There are no items in level 1 and 2.

- In April 2021, data with 1 and 2 level appears, and data with level 0 decreases. 

Sin título.png

What I'd like to obtain is a line chart where level 1 and 2 are represented from february 2021, with value=0. Graphically, this is my desired output:

 

desired_ouput.png

 

I've tried adding "+0"  to the measure that I've configured in my  y axis, but it's been unsuccessfull. How could I achieve this? 

 

Many thanks for your help.

 

Regards.

 

 

 

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try to use the date (or month) from your Dim-Calendar table, not from your fact table.

I am not sure about how your data model looks like, but try to use Dim-calendar table in X-axis with the same measure, ( adding +0)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Hank_
Helper I
Helper I

Hi! Maybe substitute null values with zeros in the query?

Isn't it more efficient to do this in M rather than DAX in this case?

Greg_Deckler
Community Champion
Community Champion

@Anonymous Not sure why the +0 is not working. You might try something like:

Value =
  VAR __Value = SUM('Table'[Column])
RETURN
  IF(ISBLANK(__Value),0,__Value)

Perhaps turn on "show items with no data"?

 

Not really enough information to go on otherwise, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Fowmy
Super User
Super User

@Anonymous 

Can you share a sample of your data?


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi @Fowmy , I'm not able to attach a pbix or xlsx file, but, in order to check if this is possible, I'm using a small set of data from CSV, with this content: 

 

ID;Level;Date
33;0;26/02/2021
33;0;31/03/2021
33;0;23/04/2021
15;1;30/01/2021
15;1;26/02/2021
15;2;31/03/2021
15;2;23/04/2021
92;1;26/02/2021
92;1;31/03/2021
92;1;23/04/2021

 

This is my visual:

 

dashboard.png

Where this is my measure Value:

 

Value =
VAR __Value = COUNT(Hoja1[ID])
RETURN
IF(ISBLANK(__Value),0,__Value)
 
And this, my desired  output:

 

Sin título.png

 

Hope this is enough 🙂

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors