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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DylanHzj
Frequent Visitor

Replace blank with 0 in line chart

Hi all,

 

Just as the picture below, I created a measure using counta function and make a line chart (week vs count text), but I found some had no points. So I checked the form and found there were several blanks. 

So, how can I replace the blank with 0 and show up on the line chart. I have tried the "if" function like Measures = if(counta([forms])=0, counta([forms]),0), but did not work.

Look forward to hearing from you if you offer any solution~

DylanHzj_0-1679397269910.png

 

1 ACCEPTED SOLUTION
Manendra
Resolver I
Resolver I

Hi @DylanHzj 

Here is a quick workaround which I did for your requirement. 

Manendra_0-1679572833877.png

You can replace blanks with 0 in your Power query editor else, you can create a calculated column using the following DAX in Power BI desktop.

 

A Column = IF(Sheet1[A] = BLANK(),0,Sheet1[A])

 

This calculated column is going to have 0 where there is a blank value in your master column, and you need to use this calculated column in your line chart to plot the zero values.

 

Here is the sample .pbix file Linechart with zeros.pbix

 

Let me know if you are still having issues.

 

Cheers, 

Manendra.

View solution in original post

3 REPLIES 3
Manendra
Resolver I
Resolver I

Hi @DylanHzj 

Here is a quick workaround which I did for your requirement. 

Manendra_0-1679572833877.png

You can replace blanks with 0 in your Power query editor else, you can create a calculated column using the following DAX in Power BI desktop.

 

A Column = IF(Sheet1[A] = BLANK(),0,Sheet1[A])

 

This calculated column is going to have 0 where there is a blank value in your master column, and you need to use this calculated column in your line chart to plot the zero values.

 

Here is the sample .pbix file Linechart with zeros.pbix

 

Let me know if you are still having issues.

 

Cheers, 

Manendra.

Manendra
Resolver I
Resolver I

Hi @DylanHzj 

 

Can you add +0 at the end of your measure? 

 

Ex: Measures = if(counta([forms])=0, counta([forms]),0)+0

 

Let me know if you are still having issues.

 

Cheers,
Manendra

Thanks for replying but this solution did not work. We still have no value in the forms.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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