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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
NasiraliKarwar
Frequent Visitor

Stacked bar graph - display 0 for blank or no data.

Hello Community,

 

I am relatively new to Power BI desktop. I need help with one particular requirement that I came across:

 

I have a stacked bar graph - In X-axis, I have 4 Quarters: Q1, Q2, Q3 and Q4 and the Y-axis shows a distinct count value. The stacked bar is split by a legend with 2 values: Expired and Pending Expiry.

NasiraliKarwar_1-1694084155141.png

 

The table view for the same data:

NasiraliKarwar_2-1694084199904.png

 

In the Table view, I can see the value 0 for Q1. But I do not see the same in the Stacked bar graph.

 

I need to display the 0 in the stacked bar graph when there is no data.

 

The formula I have used for the count is: 

SKUCount = IF(ISBLANK(DISTINCTCOUNT('Main Table'[SKU])),0,DISTINCTCOUNT('Main Table'[SKU]))
 
Is there a way to achieve this?
 
Thanks in advance!

 

 

 

 

 

2 REPLIES 2
olgad
Super User
Super User

Hi, try adding +0 in the very end of your expression:

SKUCount = IF(ISBLANK(DISTINCTCOUNT('Main Table'[SKU])),0,DISTINCTCOUNT('Main Table'[SKU])) +0


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Hello @olgad , Thank you for your suggestion! I tried it, but it still seems to be not working: 

NasiraliKarwar_0-1694152908801.png

Am I missing something?

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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