Tableau Stacked Bar Chart
Tags: tableau, datascience, bigdata, python
Published: 2020-12-13 20:06:08

Stacked Bar Chart in Tableau
The Tableau Stacked Bar Chart is useful to compare the data visually. In this article, we will show you how to Create a Stacked Bar Chart in Tableau with an example. For this Stacked bar chart example, we are going to use the Sample – Superstore Data Source.

In our ongoing article, we discussed the production of a bar chart in scene. Today in this instructional exercise, we will zero in on learning in insight concerning Tableau Stacked bar chart. We previously became acquainted with about this chart in short in our Bar chart in Tableau instructional exercise. Here, we will extend our insight on this chart further as it is a significant and valuable visualization device in data examination 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 part, we will experience a stepwise cycle of figuring out how to make a stacked bar chart in Tableau. Clearly, you can now effectively notice the trends of your data with the assistance of region chart in scene, since we tend to zero in on a greater territory instead of looking at lines. Presently, Open Tableau in your system and follow the means offered underneath to make a stacked bar chart utilizing your dataset. We utilize an example data set of Electronic store’s deals.

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.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/peib35tjo2sxr52jgfu8.png)

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.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y9exyqsixolhi1mcyz3g.png)

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.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4jp8ffmx5hatforu0nyl.png)

This partitions each bar into little shaded segments relating to different brands. Consequently, what we have now is a stacked bar chart where each bar speaks to a year and whose stature is relative to the all out deals done in that year in general.

Likewise, each bar is isolated into little hued areas which speak to the absolute deals done in that year for each brand of electronic things. At the point when you put your cursor on any hued segment it will show subtleties like Region, Sub-category, that is, the brand name, Year and absolute deals an incentive for that brand in that year.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gpltyfweh879rtzo2ql8.png)

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.change color palette of stacked bar chart

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/heb1wz24u6ecivnsp8ls.png)

In this way, we complete the process of creating a Tableau stacked bar chart with a color scheme of our choice.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bbhgg0y6ln141c1c3n6b.png)

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.

Summary
This way, you create a stacked bar chart for your Tableau workbook using your dataset. Stacked bar charts are extremely useful when you want to visualize and compare category wise data in one visualization. It lets us accommodate a lot of values and detail into one chart.

Source : https://bigdata-world.net
https://bigdata-world.net/tableau-stacked-bar-chart/