Thursday, December 28, 2023

Lesson 28 - Stacked bar chart in Power BI Desktop

A stacked bar chart is a visual representation that uses horizontal bars to display data. Each bar represents a category or group, and it is divided into segments to depict subcategories or individual components of the data. It helps illustrate the composition of a whole while showing the contribution of individual parts.


How to Proceed?


Step 1
Launch power BI desktop app and open the new report page and import the data required. 




Step 2
In “visualizations” pane click on “Stacked bar chart” which is highlighted in the given figure.






Step 3

Drag the data fields into the Build visual pane that you want to analyze using the stacked bar chart.



Y-axis: Represents categories or groups that you want to compare – Continent

X-axis: Represents the numerical value that you want to display within each category or group on the Y-axis – Medal Count

Legend: Represents subcategories within each group displayed on the Y-axis. Subcategories are visually stacked within each bar – Gender




Step 4

Filters in a stacked bar chart allow you to focus on specific categories or subcategories for deeper analysis.

In this example, I applied basic filters to exclude NA values from the Continent field and the No medal category from the Medal field.

Step 5 Customizing the appearance

You can customize the appearance of the visual using the Format visual pane. You can change the title, font size, colors, bars, data labels, and other visual properties.

Select the visual and configure the required properties in the Format visual pane.



You can choose different colors for the subcategories to differentiate them. This improves clarity and helps viewers identify the different segments within each bar.

The Reverse stacked order option allows you to reverse the order of the data series displayed in the stacked bars.

Spacing controls the space between individual bars in the chart. Adjusting the spacing can improve the appearance and readability of the visual.

Data labels display the values associated with individual segments within each bar. You can customize the font, color, and position of the data labels.

Total labels display the total value of all segments within each bar, showing the combined value of the subcategories for each category.

Note: The value axis provides a Rounded range option. Turning off Rounded range removes extra axis padding and allows the axis to align more closely with the data range. Data labels also no longer affect the axis range when they are turned on or off.


In this figure, the total labels are highlighted using red-colored circles.


Step 6 Save the visual

Finally, your Stacked Bar chart is ready. Save the Power BI report to preserve the visual and its formatting.










When to use Stacked bar chart?


Stacked bar chart and a stacked column chart in Power BI is chosen by number of categories, the length of category names, and the visual preferences of the clients. Both charts serve the purpose of illustrating the composition of total values, but the orientation differs based on whether we are using bars or columns.
  • When we want to track changes on data composition over a period of time, you can use stacked bar chart.
  • To  enhance the ability to spot patterns, anomalies, or trends in data composition more effectively, utilize the  color-coded segments in a stacked bar chart.
Pros
  • Stacked bar charts are easy to make and understand, so wide audience can use them. 
  • Effectively displays trends over a period, especially when a time series is placed on the X-axis.
  • The automatic aggregation of values within each category simplifies the presentation of cumulative data.

Cons
  • We may get confused if the bar stacks have 4 or 5 layers.
  • It is difficult to read the values when we have too many bars

Conclusion


Stacked bar charts are a useful visualization tool for displaying proportions, tracking trends over time and highlighting relative compositions within datasets. Whether you are analyzing budget breakdowns, sales distribution, or market segment compositions, a stacked bar chart often serves as the most effective visualization tool.

Useful Information


Tags Power BI
Useful links https://www.geeksforgeeks.org/power-bi-create-a-stacked-bar-chart/
MS Learn Modules https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-column-charts
Test Your Knowledge Quiz

No comments:

Post a Comment