A stacked bar chart is a form of bar chart that shows the composition and comparison of a few variables, either relative or absolute, over time. They look like a series of columns or bars that are stacked on top of each other.
Let's see how to split total sales by city and sub-category:
Create a horizontal bar chart using Sub-category and Sales (sum), sorted descending by sales(sum).
Add the Ship Mode from the Order details data to Color on the Marks card.
To change the colors, click Color on the Marks card and edit Colors.
To adjust the colors, select the data item on the left and pick a color from color palettes on the right. If you double-click the data item, you will get the option to pick color.
Once you have selected the colors you want, click the OK button. This is your final view:
Stacked bar charts are useful for showing potential relationships in the data and to display an extra level of detail.
You can enhance the chart by adding labels to each Ship mode and a total per sub-category.
To get the labels per Ship mode, click the Text icon button on the toolbar.
The view is broken down by Ship mode. To see the overall total value per sub-category, you have to add a reference line.
To add a reference line, right-click the Sales axis and click "Add Reference Line". Change, the scope to "Per Cell", value aggregation to "Sum", and label to "Value". Click Ok.
Notice that two labels are to the left of the reference line:
To right-align all the reference labels, right-click the reference line and select Format. Change the alignment to horizontal right-align and vertical middle-align.
The chart now shows the values per Ship mode and also the total value per sub-category.
You can also make the Reference line invisible by changing the line color to "none" in the Format pane.
The stacked bar chart is just one-way of showing part-to-whole relationships. Others include Treemaps or Pie charts.