Power BI Stacked Bar Chart Bar Chart is useful to compare multiple dimensions against a single measure. Let me show you how to Create a Stacked Bar Chart in Power BI with example.
For this Power BI Stacked Bar Chart demonstration, we are going to use the SQL Data Source that we created in our previous article. So, Please refer to Connect Power BI to SQL Server article to understand the Data Source.
How to Create a Power BI Stacked Bar Chart
To create a Stacked Bar Chart in Power BI, first Drag and Drop the Sales Amount from Fields section to Canvas region. It automatically creates a Column Chart, as shown in the below screenshot.
By clicking the Stacked Bar Chart under the Visualization section, it automatically converts the Column Chart into Stacked Bar Chart
Next, let me add Color to Axis section to create a Bar chart that shows Sales Amount by Color.
Next, we are adding the English Country Region Name to the Legend section to convert it into the Stacked Bar Chart.
This time, we added State Province Name to Axis, and Country to Legend. From the screenshot below, you can see Country Name is acting as the Bar Color. It is because you can’t group the Country Names inside a State ( State Name Inherited from Country). Please remember this while you are working with a stacked bar chart.
Hover over any stacked bar shows the Tool-tip of State Name, Country, and its Sales Amount
Create a Power BI Stacked Bar Chart Approach 2
First, click on the Stacked Bar Chart under the Visualization section. It automatically creates a Stacked Bar Chart with dummy data, as shown in the below screenshot.
In order to add data to the Power BI Stacked Bar Chart, we have to add the required fields:
- Axis: Please specify the Column that represents the Horizontal Bars.
- Legend: Specify the Column to divide the Horizontal Bars.
- Values: Any Numeric value such as sales amount, Total Sales etc.
Let me drag the Sales Amount from the Fields section to the Values field, and Color field to the Axis Section.
Next, add the English Country Region Name from the DimGeography table to the Legend section. You can do this by dragging Country to Legend section, or simply checkmark the English Country Region Name column
Now you can see a Stacked Bar Chart that represents Sales by Color, which is further divided by Country Name. Hover over any portion on a bar shows the Tool-tip of Color, Country, and its Sales Amount.
Let me do some quick formatting to this Power BI Stacked Bar Chart
NOTE: I suggest you refer to Format Stacked Bar Chart article to understand the steps involved in formatting the Stacked Bar Colors, Chart Title, Data Color, background Color, Axis Colors, Axis fonts style and colors, etc.