How to Show Zero Values in Power BI Bar Chart?

Recently, I have been working on a Power BI report where I want to create a bar chart showing zero values. The problem is that the data set has no zero value; it has blank cells, which we need to show as zero.

Also, we can create a Power BI bar chart that doesn’t show zero values.

Show Blank Value as Zero in Power BI Bar Chart

For this example, I created a table (Product table) using the Enter data feature in Power BI.

The data table shows that the “mouse” and “mike” prices are null or blank.

power bi bar chart show blank values

If we use this data to create a bar chart in Power BI Desktop to display the price based on product, it will only show the data for products with available prices, as shown in the screenshot below.

show items with no data power bi

But we want to show the blank Value as Zero, and if we add a data label, the data label shows as zero. We can achieve this using two ways:

  1. By using a measure.
  2. Using the Power Query editor to replace the null values with 0.

Display Zero Value in Power BI Bar Chart using Measure

Let me show you how to create a measure that will replace the null values with 0.

1. Open Power BI Desktop and create the above data table using the “Enter data” option. Then, under the Modeling tab, click “New measure.”

power bi hide items with no data

2. In the formula bar, put the below Dax expression.

Total Price = CALCULATE(SUM('Product'[Price])) +0
power bi bar chart to show 0 values

3. select the Stacked bar chart from the Build pane to create a bar chart. Then, drag and drop the Product on the Y-axis and the Total Price onto the X-axis.

power bi stacked bar chart show zero values

4. Next, go to the Format pane and enable the Data label option. Then, you can see the zero value in the Power BI stacked bar chart.

power bi stacked bar chart show 0 values

Display Zero Value in Power BI Bar Chart using Power Query Editor

Like measure, let me show you how to use the Power Query editor to replace null values with zero.

After loading the data into Power BI Desktop, under the Home tab, click Transform data.

what is the value of 0 power 0

Then, the Power Query Editor will open. Select the Price column and click Replace value.

power bi show zero values

A Replace Values popup will appear. In it, put Value To Find as null and Replace With as 0, then click OK.

power bi show items with no data as 0

After that, the null value will be replaced with 0. Then, under the File tab, click Close & Apply.

power bi show blank as 0

You can then directly create the bar chart and enable the data labels to see the zero values.

power bi show 0 instead of blank

These are the two ways you can show the blank Value as Zero in the Power BI bar chart.

Hide Zero Value in Power BI Bar Chart

Sometimes, we may need to hide the zero value in the Power BI bar chat. For example, in the above bar chart, you see the price for the “Mouse” and “Mike” products is 0. Now, I want to hide these two products in the bar chart.

We can achieve this using a Filters panel:

  • Select the bar chat and expand the Filters pane. Under Filter on the visual section, expand the Sum of Price option.
  • Then, Show items when the value is not 0. Then click on the Apply filter.
Microsoft power bi bar chart hide 0 values

Now you can see the Power BI bar chart doesn’t show a 0 value.

power bi bar chart don't show 0 values

This is how to hide zero value from the Power BI bar chart.

Show blank Value in Power BI Bar Chart

While researching how to Show Zero Values in a Power BI Bar Chart, I found another method. However, if we add a data label to the bar chart, it does not show zero, which means it shows a blank value.

For example, we have created a table (a Product table) using the Enter data feature in Power BI.

power bi bar chart show blank values

The above data shows that the price is blank for “Mouse” and “Mike.”

If we use this data to create a bar chart that will display the price based on product, it will only show the data for products with available prices, as shown below.

Microsoft power bi bar chart show blank values

To display “Mouse” and “Mike” in the chart, we must enable the option ‘Show items with no data.’

To do this, select the Stacked bar chart from the Build pane to create a bar chart. Next, drag and drop the Product to the Y-axis and the Price to the X-axis.

power bi bar chart don't show zero values

To show the blank values in the Power BI bar chart, right-click on the Product and select the ‘Show items with no data‘ option.

show blank values power bi bar chart

Now you can see the Power BI bar chart showing the blank value in the Power BI bar chart.

show blank values in power bi bar chart

Conclusion

Now, if your data set has a blank or null value, you can easily change it to zero, and if you want, you can show the blank value in the Power BI Bar chart.

In the above, I clearly explain how we can show a blank value in the Power BI bar chart and hide a zero value in the Power BI bar chart.

You may also like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…