Power BI Bar Chart + Conditional Formattings

This Power BI tutorial will help you how to work with the Power BI Bar chart.

In this article, we will explain what is a bar chart, what a stacked bar chart, what a clustered bar chart, and what a 100% stacked bar chart.

Also, I will tell how to create a bar chart, stacked bar chart, clustered bar chart, and 100% stacked bar chart with various examples. Additionally, we will see how to apply conditional formatting in Power BI Bar chart.

Power BI Bar Chart

In Power BI, a bar chart is like a picture that shows information using bars of different lengths. These bars help compare values. Each bar stands for a group, and the length of the bar tells you how much there is for that group.

For example, you have a list of products, and you want to see each product’s sales value.

Power BI Bar Chart

How to create a bar chart in Power BI

I have a SharePoint list (Finance Sample) that contains below columns with various data types:

ColumnDatatype
CountrySingle line of text
ProductSingle line of text
Units SoldNumber
ManufacturingNumber
Sale PriceCurrency
ProfitCurrency
SalesCurrency
Gross SalesCurrency
create a bar chart in Power BI

Now open Power BI and load the Sharepoint list in Power BI Desktop.

1. Select the Stacked bar chart below the Visualizations panel in the Power BI Desktop. You see the one empty bar chart added to the report view.

Power BI stacked bar chart

2. Here, I want to display the Sum of Sales by Country in a bar chart. To do so, drag the “Country” Column into the Y-axis field and the “Sales” into the X-axis field.

bar chart in Power BI

In these steps, you can create a bar chart in Power BI.

Types of Power BI Bar chart

In Power BI, there are three types of bar charts available:-

  • Stacked Bar Chart
  • Clustered Bar Chart
  • 100% Stacked Bar Chart

Power BI Stacked Bar Chart

In Power BI, a stacked bar chart is similar to stacking differently colored blocks on top of one another. Each block represents a portion of the whole, and the height of the stacked blocks shows the total for each category.

How to create a Stacked Bar chart in Power BI

Now, Open Power BI and load data, then click the Stacked bar chart below the Visualizations panel.

Power BI stacked bar chart

Here, I want to display the Sum of Sales by Product and Country in a stacked bar chart.

So do this: drag “Product” into the Y-axis field, “Sales” into the X-axis field, and “Country” into the Legend field. Check the screenshot below.

Create bar chart in Power BI

Using these processes, you can create a stacked bar chart.

Power BI Clustered Bar Chart

It is a type of bar which used to display a series of two or more data sets in horizontal clustered bars.

How to create a Clustered Bar chart in Power BI

1. Open Power BI and load data then, In the below Visualizations panel, select the Clustered bar chart. Then, an empty clustered visual was added to the report page.

how to create bar chart in Power BI

2. Now, I will create a clustered bar chart that displays the Sum of Sales and Sum of Profit by Product. So drag the “Product” into the Y-axis, and drag the “Sales” and “Profit” into the X-axis. Here, choose the value as the Sum of Profit and Sum of Sales as shown in the figure below:

Use of clustered bar chart in power bi

In this way, you can create a clustered bar chart.

Power BI 100% Stacked Bar Chart

In Power BI, a 100% stacked bar chart is like a bar chart where the total height of the bars always adds up to 100%. Each bar represents a category, and the segments within the bar show the proportion of different components or values.

How to create a 100% Stacked Bar chart in Power BI

1. Open Power BI Desktop and load data, then click on the 100% Stacked Bar chart below the Visualizations panel. After that, an empty 100% Stacked Bar chart was added.

100% Stacked Bar Chart in Power bi

2. Here, I want to display the sum of profit by product and country in a 100% stacked bar chart. So, drag “Product” into the Y-axis field, “Profit” into the X-axis field, and “Country” into the Legend field.

how to create 100% Stacked Bar Chart in power bi

In this way, you can create a 100% stacked bar chart.

Power BI Bar Chart with Multiple Values

I will show you how to create a stacked bar chart with multiple values in Power BI Desktop.

1. Open Power BI Desktop and load the SharePoint list, then click the stacked bar chart under the visualization panel.

power bi stacked bar chart with multiple values

Here, we show multiple values; drag and drop two data source columns into the X-axis field in the Visualizations navigation.

2. Now drag “Product” into the Y-axis; in the X-axis, drop “Profit” and “Sales.”Check the screenshot below.

Power BI stacked bar chart with Multiple values

Follow the above steps to create a stacked bar chart with multiple values.

Power BI Bar Chart Shows the Value and Percentage

Now, I will tell you how to show the value and Percentage in a bar chart.

1. In this example, first, we create a bar chart that displays the Sum of sales by Product. The Y-axis contains “Product,” and the X-axis contains “Sum of Sales.”

Power BI bar chart show percentage

2. For the Percentage, we created a new measure. Goto Modeling -> Click New Measure.

power bi show value and percentage

3. Under the formula bar, add the below DAX.

Syntax:

Percentage = (SUM(tablename[valuefield])/CALCULATE(SUM(tablename[valuefield]),ALL(tablename[categoryfield])))
  • In my case, the formula is:
Percentage = (SUM('Financial Sample'[ Sales])/CALCULATE(SUM('Financial Sample'[ Sales]),ALL('Financial Sample'[Product])))
Power BI Chart Shows the Value a Percentage

4. Clicking the “%” symbol in the Formatting section after entering the formula. Then click commit. Check the screenshot below.

create user profile card using SharePoint Online modern list view customization

5. You see one Percentage (measure) added to your Data panel.

Showing % in Power BI bar chart

6. Drag the Percentage into “Tooltips” below the Visualgitons Panel. Now the bar chart displays the Sum of Sales and Percentage by Product.

Power BI bar chart show value and Percentage example

7. When you hover over the bar, a Tooltips dialog box opens, and you see the percentage of the product.

Bar chart with percentage in Power BI

Follow the above steps to create a bar chart showing the value and percentage.

Power BI Adds a Line to the Bar Chart

Now, I will show you how to add a line to the bar chart.

For this example, we have a product and sales data set. Now, add a constant line to the chart.

1. I created a bar chart that displays the Sum of Sales by Product. The Y-axis contains “Product,” and the X-axis contains “Sum of Sales.”

Power BI adds a line to the bar chart

2. Then, we add a line to the chart; click on analyses to your visual under the Visualizations panel. Add a Constant line to the bar chart.

How Can I Add a line to a Chart in Power BI

3. First, give the name of the line. Enter the value for the constant line. Customize the line style and color as desired.

In my case, the name given is ‘Constant Sales,’ with a specified value of 1500000. and the line color is set to black

Power BI adds a Constant line to the bar chart

Following the above steps, we can add a constant line to the bar chart.

Power BI Bar Chart Conditional Formatting

The first image displays a Power BI Bar chart with no bar color in a Power BI report. I want to change the Bar chart Bar color with various colors based on some conditions.

After applying the conditional formatting, the Bar chart will display with color bars, as shown in the second image.

Power BI Conditional Formatting Bar Chart

I have a SharePoint list (Finance Sample) that contains below columns with various data types:

ColumnsData Types
CountrySingle line of text
ProductSingle line of text
Discount BandSingle line of text
Units SoldNumber
ManufacturingNumber
Sale PriceCurrency
Gross SalesCurrency
SalesCurrency
Create a new user in windows server 2016

I hope you open Power BI Desktop and load the data set in the Power BI. If you are new to Power BI, you can read an article about Create a Report from SharePoint List in Power BI.

1. I created a Power BI bar chart displaying the “Sum of Sales by Country.” The Y-axis contains the “Country,” and the X-axis contains the “Sum of Sales.”

Power BI bar chart color based on value

2. Now we apply conditional formatting for bars in Power BI

  1. Go to “Format your visual” Below the Visualisation navigation.
  2. Click on Visual format.
  3. Expand Bars under the Visual tab.
  4. Expand the Colors option.
  5. Click on the fx icon. Check the screenshot below.
Example for Power BI bar chart color based on the value

3. Now, it will open a conditional formatting page where we add color based on the value.

  1. Choose the Format style as “Rules”.
  2. Choose the column field value. In my case, “Sum of Sales.”
  3. Add +New rule.
  4. Now, put the minimum value, maximum value, and color.
  5. Then click “OK”. Check the screenshot below.
Power BI changes the color of the bar chart

4. After that, our bar chart color changed based on value.

Power BI bar chart conditional formatting

In this way, we can change the color of the bar chart by using Power BI bar chart conditional formatting.

Power BI Bar Chart Color by Category

In Power BI, the Bar Chart Color by Category feature allows you to assign different colors to the bars in a bar chart based on the categories in your data.

The first image displays a Power BI Bar chart without changing the color. After applying Power BI Bar Chart Color by Category, the Bar chart will display with color bars, as shown in the second image

Power BI Bar Chart Color by Category

I have a SharePoint list (Amazongo) used in this example.

ColumnsData Types
Order DateDate and time
Customer NameSingle line of text
StateSingle line of text
Product NameSingle line of text
CategorySingle line of text
Sub-CategorySingle line of text
SalesCurrency
ProfitCurrency
power bi conditional formatting bar chart based on field value

In this table visual, we have a product list. The product is divided into different categories and the products have their sales.

Power BI bar chart conditional formatting example

Using the data set, we create a bar chart that shows bar Color by “Category” in Power BI.

1. First, we create a bar chart that displays the “Sum of Sales by Product Name.” The Y-axis contains “Product Name,” and the X-axis contains “Sum of Sales.”

SQL Server Functions Tutorial

2. Now we apply condition formatting to the bar chart:-

  • Click on Format your visual -> Visual -> Bars
  • Expand the Colors option and click on the fx icon.
Example for Power BI bar chart color based on the value

3. It will open a condition formatting page where you:-

  1. Choose Format style ->Rules.
  2. Choose the column field value -> First Category.
  3. Add +New rule.
  4. Apply your rule, like if value Office Supplies, then color.
  5. Click on “OK.”
Changing Data Color for a bar chart Power BI

3. Now, you see the bar color change based on category.

Create Bar Chart with Colour Formatting

Here, we are creating the bar chart color by category, but it’s difficult to say which color is in which category.

To solve this problem, add the “Category” into the Tooltips Below the Visualisations pane. Then, hover over the bar, and you can see the “Category” in the dialog box.

Power BI bar chart color by category example

Using this process, we can create the Power BI Bar chart color by category.

How to Sort Bar Chart in Power BI

When we create a bar chart, you must see, by default, that it is sorted by values in descending order, but we can sort it in ascending order in simple steps.

How to Sort Bar chart in Power BI

Here, I connected the SharePoint List to Power BI Desktop. If you don’t know how to connect the SharePoint List to Power BI, click here.

Here is the SharePoint list that I am using for this Bar chart. You must have a SharePoint list before creating and sorting the bar chart. See the screenshot below:

Sort bar chart in Power BI

1. Now select the stacked bar chart under the visualization panel.

power bi sort columns alphabetically

2. I want to show the “Sum of sales by Product Name”. So, drag “Product Name” into the “Y-axis” and then drag “Sales” into the “X-axis” field. Here, choose the value as Sum of Sales as shown in the figure below:

how to sort bar chart in power bi

3. Select the bar chart. Click on the upper-right side of our visual. You will find the More Options (3 dots) button. Then, the dialog box opened. In the dialog box, click “Sort axis”.

How to Sort Bar Chart values in Power BI

“Product Name” means the alphabet, and “Sum of Sales” means value. We can sort by value (ascending/descending) or alphabet (ascending/descending).

4. Select “Product Name” and “Sort ascending” and see the changes in the screenshot below.

Create Data Connection in InfoPath in SharePoint

Here, you see the above bar chart sorted in alphabetical ascending order.

5. Select “Product Name” and “Sort descending” and see the changes in the screenshot below.

power bi sort columns alphabetically descending order

This way, we can sort the bar chart in Power BI Desktop.

Conclusion

I hope this tutorial is helpful to you. This tutorial covers the fundamentals of bar charts, explaining their types. Additionally, we learned to create various visuals, such as the bar visual, stacked bar, clustered bar, and 100% stacked bar visualizations.

Also, I explained some real-time examples in the Power BI Bar chart.

Moreover, you may like some more Power BI tutorials:

>

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…