How to create a Tableau Stacked Bar Chart
Updated on 29th Sep, 21 18 Views

Data visualization in Tableau allows you to convert the complex datasets into visually interactive figures so that any user can understand and make sense of that complex data. Tableau offers numerous visualizations in terms of graphs, scatter plots, charts, maps, etc.

Among these, bar charts are the most widely used visualizations by data scientists and business analysts. However, tableau takes these visualizations to another level and offers Stacked bar charts. This allows you to stuff more information and compare different data variables in a single visualization.

So, let’s go through the topics that we’ll be covering in this tutorial:

Check out the Tableau tutorial for beginners to learn more about data analytics and visualization:

What is a Stacked Bar Chart?

A stacked bar in Tableau is a type of bar chart that represents values in the form of segmented bars. Here, each bar is divided into different segments or sections, providing further details about the field and regions. With this, not only can you compare the main data variables, but also have the distribution of smaller variables in every bar.

You can segment the bar chart based on any field such as regions, brands, profit, and more. For example, if a bar chart shows the total sales of each product category, then a segmented bar chart can show you the sales done for every product in different parts of the world. Thus, you can have more information about the sales and perform a detailed analysis and make better decisions.

Now, let’s move forward and create a Stacked bar in Tableau in both vertical and horizontal format.

Check out the Tableau interview questions if you’re preparing for a job interview.

How to Create Stacked Bar Charts in Tableau?

Creating a Stacked bar chart in tableau is a fairly easy process. You just have to drag and drop the fields in the corresponding rows and columns and select the type of figure you want from the visualization panel.

In this tutorial, we’ll use a sample and dataset named ‘Sample_Superstore.xls’ which you can download and use as the dataset. There are mainly two types of stacked bar charts in tableau: vertical and horizontal. So, let’s create these charts and apply different features to them.

Get 50% Hike!

Master Most in Demand Skills Now !

Create a Vertical Stacked Bar Chart Tableau

Following are the instructions for creating a vertically stacked bar chart in tableau:

  • Open your Tableau Desktop software and select Microsoft Excel under the Connect section on the left side of the interface.
  • Load the sample dataset and create the relation between different tables as shown below:
  • Here, you can also do some changes in the datasets by adding more rows or columns, removing redundant values, replacing null with some default values, and more.
  • Once you’re done with all the changes, go to the Worksheet by clicking on the sheet1 option at the bottom-left corner.
  • Now, select the Sales dimension from the Data panel(on the left side of the Tableau interface) and drop it in the Rows section just below the toolbar. Similarly, drag the Order Date dimension and drop it in the Columnssection.
  • If your visualization is changed once you’ve dropped the other dimensions, then interchange them and the bar graph shall resurrect.
  • Now, let’s add another dimension to our simple bar chart and convert it into a Stacked one. To do so, drag the Sub-Category dimension and drop it into the Marks section.
  • Also, you can add the dimension Regions in the Columns section and make four separate sections representing each year.
  • If you want, you can also assign different colors to each segment of your stacked bar chart by assigning the Color card to the Sub-Category dimension.
  • To change the color of your stack’s bar, click on the Color option in the Marks sections, select Edit Colors, and change the colors.

Now, let’s go through a quick guide and learn how to create a horizontal stacked bar chart in Tableau Desktop.

Become a Business Intelligence Architect

Create a Horizontal Stacked Bar Chart Tableau

Follow the steps given below to create a Horizontal Stacked Bar in Tableau:

  • Add a new worksheet from the bottom-left corner, and drop any two dimensions in the rows and columns section. For example, let’s consider the dimension Region & Order Date for the column section and Sales for the row section.
  • In the picture above, you see a vertical chart has been created, but we want a horizontal one. So, to convert this figure into a horizontal bar chart, either click on the Swap(or press Ctrl+W) button right under the Server option or select Horizontal bars from the Visualization panel.
  • The converted chart would look like this:
  • Now, let’s add the Category and other dimensions as labels or colors and convert our horizontal chart into a stacked bar chart.
  • If you want to add information to your bar chart or make it interactive, you can add more labels or create action filters.

Career Transition

Take the Tableau online training and learn the core tools used to perform data analysis and visualization projects.

Creating a Tableau Stacked Bar Chart using Multiple Measures

You can also create the Tableau Stacked bar chart using multiple measures. So, let’s go through and steps given below and learn how to create a Tableau stacked bar chart using multiple measures:

  • Open a tableau Worksheet, add Order Date to the column section, and Measure Names to the marks section.
  • Click on the Measure Names drop-down menu and select the Filter option.
  • Now, select only the Sales and Profit measure in front of the dialog box and apply the changes.
  • Following that, drop the Measure Values in the Rows section, and a line graph will appear on the screen.
  • Open the drop-down menu under the Marks section and click on the Bar option. A
  • A Stacked chart will be created with each bar segmented based on the profit. Here, you can assign different colors by changing the Measure Name from Details to Colors.
  • Once the Measure Names are changed, press the Ctrl button and drop measure Values to labels in the Marks section.
  • Now, you can format the Measure Values using the drop-down menu and also resize the bar chart to the desired size.

Now that you’ve created a stacked bar chart, let’s see how to add different labels, measures, tableau Stacked bar chart percentage labels, and other features to your visualization.

Take the Tableau Server training and learn how to organize, edit, and collaborate with other users to work tableau dashboards.

Adding Feature to a Stacked Bar Chart in Tableau

There are several ways to make your bar chart more interactive and deliver better results. For instance, you can show how much profit you’ve earned in different regions or states. Also, you can see how many products have been sold out by adding the Quantity measure.

Moreover, you can make your Tableau Stacked Bar chart to change the order in which you see the values, and arrange them in either ascending or descending order.

So, let’s go through the following process and create some of these measures or labels:

How to add Tableau Stacked Bar Chart Total?

Below are the steps to create and add the total to the stacked bar chart in Tableau:

  • Create a bar chart using the Profit and State as your dimension. For this guide, we removed some of the rows to make the visualization more clear and simple. You can do so, by adding the State and going to the dropdown menu>> filter>> Exclude.
  • Add the Ship Mode dimension in the Colors and Profit to the labels in the Marks section. A chart with stacked bars will appear.
  • Now, right-click on the row panel and select the ‘Add Reference Line’ option. A dialog box will appear. Do the exact changes as shown in the picture below, and click OK.
  • The resulting visualization will look like this:

Adding Color Schemes to the Stacked Bar Chart

Tableau also allows you to change the colors of individual segments or even add custom colors by creating a color palette. Following are the steps to adding a color scheme to the Stacked bar chart:

  • Open any bar chart like the horizontal bar chart and click on the Color button under the Marks section. Select edit Colors and a dialog box will appear on the screen.
  • From here, you can either assign a color palette, select a different color combination, or assign different shades of the same color.
  • I’ve assigned three shades of blue color to the different items based on their position in the bar segment, and the result is this beautiful-looking Stacked bar chart.

Conclusion

So that was all about creating a Stacked bar chart and using it in different ways in Tableau. Bar charts are some of the most used visualizations in both analytics and Business Intelligence. Stacked charts allow you to compare multiple categories and accommodate multiple data values in a single visualization.

Check out our Business Intelligence Community page in case you have any doubts.

Course Schedule

Name Date
Power BI Training 2021-10-30 2021-10-31
(Sat-Sun) Weekend batch
View Details
Power BI Training 2021-11-06 2021-11-07
(Sat-Sun) Weekend batch
View Details
Power BI Training 2021-11-13 2021-11-14
(Sat-Sun) Weekend batch
View Details

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for 50% Salary Hike ?

Speak to our course Advisor Now !

Associated Courses

Subscribe to our newsletter

Signup for our weekly newsletter to get the latest news, updates and amazing offers delivered directly in your inbox.