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.
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.
How to create a bar chart in Power BI
I have a SharePoint list (Finance Sample) that contains below columns with various data types:
|Single line of text
|Single line of text
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.
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.
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.
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.
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.
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:
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.
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.
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.
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.
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.”
2. For the Percentage, we created a new measure. Goto Modeling -> Click New Measure.
3. Under the formula bar, add the below DAX.
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])))
4. Clicking the “%” symbol in the Formatting section after entering the formula. Then click commit. Check the screenshot below.
5. You see one Percentage (measure) added to your Data panel.
6. Drag the Percentage into “Tooltips” below the Visualgitons Panel. Now the bar chart displays the Sum of Sales and Percentage by Product.
7. When you hover over the bar, a Tooltips dialog box opens, and you see the percentage of the product.
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.”
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.
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
Following the above steps, we can add a constant line to the bar chart.
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:
- Power BI Stacked Bar Chart Sorted by Value
- Sort Bar Chart in Power BI
- Power BI Line Chart Conditional Formatting
- Dynamic Column Headers in Power BI
Preeti Sahu is an expert in Power Apps and has more than 6 years of experience working with SharePoint and the Power Platform. As a Power Platform expert for Power BI, Power Apps, Power Automate, Power Virtual Agents, and Power Pages, she is currently employed with TSinfo Technologies. She is the author of the book Microsoft Power Platform A Deep Dive. She also made a big technical contribution to SharePointDotNet.com in the form of articles on the Power Platform. She enjoys traveling and spending time with her family in her spare time.