You are on page 1of 6

Tableau Stacked Bar Chart –

Artistic approach for handling data


In our recent article, we talked about the creation of a bar chart in tableau.
Today in this tutorial, we are going to focus on learning in detail about
Tableau Stacked bar chart. We already got to know about this chart in brief in
our Bar chart in Tableau tutorial. Here, we will extend our knowledge on this
chart further as it is an important and useful visualization tool in data analysis
and business intelligence.
What is Stacked Bar Chart?
A stacked bar chart is a simple bar chart with segmented bars. The bars in a
stacked bar chart represent distinct values of a field on one axis. Each of these
bars is also internally divided into different sections or segments providing
further detail into the field values. In this way, we can compare the main
values as a whole and also have insight into the distribution of smaller
segments of a bar.

For instance, if in a bar chart, one bar corresponds to the total sales done for
electronic items in the year 2019, then multiple segments within that bar can
show the number of total sales done for each brand like Sony, Dell, Asus, etc.
Thus, we can carry out a detailed analysis and comparison of sales made in the
year 2019 as a whole and see the contribution made by each brand.

You can take a maximum of one dimension field or category axis in a stacked
bar chart and up to two measure fields, that is, numerical axes.

How to Create Tableau Stacked Bar


Chart?
In this section, we will go through a stepwise process of learning how to create
a stacked bar chart in Tableau. Apparently, you can now easily observe the
trends of your data with the help of area chart in tableau, because we tend
to focus on a bigger area rather than comparing lines. Now, Open Tableau in
your system and follow the steps given below to create a stacked bar chart
using your dataset. We use a sample data set of Electronic store’s sales.
STEP 1: Create a Simple Vertical Bar Chart
We select a dimension; Order Date from the Dimensions section and put it into
the Columns section. Please note that we select YEAR as the field values
for Order Date.
Next, we select Sales from the Measures section and put it into
the Rows section. Here, we select SUM as the aggregation type.

Then we select the stacked bar chart option from the visualization pane
present on the right. This creates a simple vertical bar chart with years on its x-
axis and sales on the y-axis.
STEP 2: Add Region Dimension into the Column Section
Now, we add one more detail to our chart that is, Region dimension into
the Columns section. This adds four sections or columns for four regions. Each
column now has a set of four bars each pertaining to a year.

STEP 3: Convert Simple Bar Chart into Stacked Bar Chart


Next, we perform the step to make this bar chart a stacked one. We add the
dimension Sub-Category into the Color card of the Marks section.

This divides each bar into small colored sections pertaining to different
brands. Thus, what we have now is a stacked bar chart where each bar
represents a year and whose height is proportional to the total sales done in
that year as a whole.

Also, each bar is divided into small colored sections which represent the total
sales done in that year for each brand of electronic items. When you put your
cursor on any colored section it will show details like Region, Sub-category,
that is, the brand name, Year and total sales value for that brand in that year.

STEP 4: Add Color Scheme into the Stacked Bar Chart


We can also change the color scheme of our stacked bar chart from
the Color card present in the Marks section. From the Edit Color option, we
can browse through the many available color palettes and then click on Assign
Palette to set a color scheme for our bar chart. Click on OK to complete this
step.

In this way, we complete the process of creating a Tableau stacked bar chart


with a color scheme of our choice.

Creating Tableau Stacked Bar Chart with Data


Labels
We can make our bar chart more informative by adding data labels. To add
data labels drag and drop a relevant field from Dimension or Measure section to
the Label card in the Marks section given on the left. You can format the font
and style of the labels by clicking on the Label card. In this way, we can have
labels on each bar specifying data values.

You might also like