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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JustinDoh1
Post Prodigy
Post Prodigy

Plot zero when there is no data in line chart

I am sharing my Pbix file here.

 

I tried with suggestions from several posts, but I am still not getting this issue resolved.

https://community.powerbi.com/t5/Desktop/Plot-zero-when-there-is-no-data-in-line-chart/m-p/506235#M2...

https://community.powerbi.com/t5/Desktop/Plot-zero-when-there-is-no-data-in-line-chart-solution-affe...

https://community.powerbi.com/t5/Desktop/Show-zero-when-there-is-no-data-in-line-chart/td-p/401921

 

Basically, I am trying to display zero (goes down to zero level) when count of client is zero / if there is no value.

During the month of June and July 2021, for these criteria (M*H*C* and Private), there is no data (blank value).

 

Bottom is screenshot of what we have now:

JustinDoh1_0-1639682097132.png

 

Bottom is expected result:

JustinDoh1_1-1639682690934.png

I tried with following measures (to have a line graph goes down to Zero), but nothing seems to work:

ClientD_M = COUNT('vw_census_trend'[ClientID]) + 0
ClientID_M1 = CALCULATE(count(vw_census_trend[ClientID]), vw_census_trend[ClientID] > 0)

ClientD_M2 = COUNTX('vw_census_trend','vw_census_trend'[ClientID]) + 0

ClientD_M3 = IF( ISBLANK (COUNT(vw_census_trend[ClientID])), 0COUNT(vw_census_trend[ClientID] )) + 0
 
What would be the solution?
 
Thanks.

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@JustinDoh1 What date are you using on the chart? You need to use the DimDate date, and then just do 
https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html 
Zero Measure = [Measure] + 0


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

3 REPLIES 3
JustinDoh1
Post Prodigy
Post Prodigy

@AllisonKennedy

Thank you so much for your help.

I think the major portion of issue was resolved, but line graph still does not go down to zero.

So, I am thinking it might be an issue with a Measure.

I have a question. How do we write measure likeZero Measure = [Measure] + 0 ) from what I have tried?

 

ClientD_M = COUNT('vw_census_trend'[ClientID]) + 0
ClientID_M1 = CALCULATE(count(vw_census_trend[ClientID]), vw_census_trend[ClientID] > 0)

ClientD_M2 = COUNTX('vw_census_trend','vw_census_trend'[ClientID]) + 0

ClientD_M3 = IFISBLANK (COUNT(vw_census_trend[ClientID])), 0COUNT(vw_census_trend[ClientID] )) + 0
 
BTW, I have an updated Pbix file here that has a relationship with DimDate table.
I was using bottom measure:
ClientD_M = COUNT('vw_census_trend'[ClientID]) + 0
And, I was expecting to see a line graph drops to zero from June to July 2021 on these conditions, but it only displays line graph that has a value. 
 
JustinDoh1_0-1639759893804.png

 

 

@JustinDoh1  See attached upated file. 

 

You got halfway there with the DimDate table but still need to:

* Mark it as Date table

* Use it in the visuals and slicer

 

I have made both changes in the attached file and I think it's behaving as expected now.

 

Since there are no entries for June, July you'll never see those on the linechart if you use the Report Date, that's why a Date table is so important. Does that make sense hopefully?

 

Cheers!


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

@JustinDoh1 What date are you using on the chart? You need to use the DimDate date, and then just do 
https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html 
Zero Measure = [Measure] + 0


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.