Power BI Stacked Bar Chart Bar Chart is useful to compare multiple dimensions against a single measure. In this article we will show you, How to Create a Stacked Bar Chart in Power BI with example.
For this demonstration we are going to use the SQL Data Source that we created in our previous article. So, Please refer Connect Power BI to SQL Server article to understand the Data Source.
How to Create a Power BI Stacked Bar Chart
In order to create a Stacked Bar Chart, first Drag and Drop the Sales Amount from Fields section to Canvas region. This will automatically create a Column Chart as we shown in below.
By clicking the Stacked Bar Chart under the Visualization section will automatically convert 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 English Country Region Name to 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 below screenshot you can see, Country Name is acting as the Bar Color. This is because, You can’t group the Country Names inside a State ( State Name is Inherited from Country). Please remember this while you are working with stacked bar chart.
Hover over any bar will show you 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. This will automatically create a Stacked Bar Chart with dummy data as shown in the below screenshot.
In order to add data to Staked Bar Chart, we have to add required fields:
- Axis: Please specify the Column that represent 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 Fields section to Values field, and Color field to the Axis Section.
Next, add the English Country Region Name from DimGeography table to the Legend section. You can do this by dragging Country to Legend section, or simply check mark the English Country Region Name column
Now you can see a Stacked Bar Chart that represent Sales by Color which is further divided by Country Name. Hover over any portion on a bar will show you the Tool-tip of Color, Country, and its Sales Amount
Let me do some quick formatting to this Stacked Bar Chart
NOTE: I suggest you to refer 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 etc.
Thank You for Visiting Our Blog