Type to search

Create Equal Size Sorted Stacked Bars in Tableau


During my Corporate Tableau Training in Gurgaon , i get questions many time regarding Sorted Stacked Bars in Tableau . Creating a Stacked bar in tableau is quite easy.

Stacked bars are best used to analyze two dimensions against a single measure. Let’s take it with a proper use case and since we are very comfortable with Sample Superstore data set we will use the same for this analysis.

There is a popular saying If you give a man Fish Daily to eat he will survive as long as he is getting the Fish , but If you teach him how to Fish he will Live his Life Time . So a Real Teacher is one who can sow the Seed of Curiosity , that motivates the students to get on the Path . 

So Let’s Follow a Different Approach this time . Rather than me showing you all the steps , I will just write down all the steps required and you need to follow it along and you will get what we want. There will be some challenges and you will need to explore more and think a little more but that is what is expected. If you get stuck somewhere for a large duration of time you can email me at info@Instrovate.com and i can help you answer where you are getting stuck . So go ahead and Follow along –>

Analysis: we want to analyze the Sales of all the Sub Category in the various Region.

  1. Let’s connect Tableau to Sample Superstore Data set And drag Sub Category to Column & Sales to Rows. Drag Region to Color & our Stacked bar is ready. We have the sales of all the Sub Category in Various Region.
  2. Step Ahead: Let’s take this analysis a step ahead. What we have prepared above is a normal Stacked bar analysis. If we want to Sort each of the Stacking in each of the bars, it would not be possible from the face of Tableau. By sorting each of the stacks in the bars, I mean that each Sub Category should show the regions in a descending manner within it self. That would be a specific visualization. So lets take our visualization a step ahead.
  3. Go back to the above visualization and change the Region on the Marks Card in the Color Shelf to Attribute by right clicking it.
  4. On Changing the Region to Attribute the viz will change. Go to the Data Pane and Create a Combined field of Region and Sub Category (Select Region and Sub Category holding onto your control in your Windows OR to your command in your Mac and right click to Create Combined field).
  5. Drag this new created Combined Field to the Detail Shelf in the Marks Card like below:Then right click this Combined Field on the Detail shelf to open the Sort Option.On clicking on Sort you will get the Sort pop up. Select Descending in it and Sort By Field Should be Sales, like below:
  6. Now you will notice that each of the Stacking in each of the Bars are Sorted. This is Sorted Stacked bars—a step ahead of Stacked bars.

Step Ahead 2: We have a Sorted Stacked bar now, but the analysis of those Stacked bars whose overall Sales is less is not easy as the length of these bars are very small; like for example for Fasteners, Labels, Envelopes etc.

In case you don’t want to analyze the total Sales of each of the Sub Categories but only the Sales per Region in that case you can create Equal Size Sorted Stacked Bars.

To create Equal Size Sorted Stacked Bar create a Calculated Field called Size .Bring this new created Field to Row in the viz and change the Aggregation to minimum like below:

Now we can remove Sum(Sales) from the Rows and we have Equal Size Sorted Stacked Bars . This viz is good to show the Sales of the Sub Category in the Various Region & at the same time it is also telling us which Region is leading the Sales for that particular Sub Category.

If you get stuck somewhere for a large duration of time you can email me at info@Instrovate.com and i can help you answer where you are getting stuck .


You Might also Like

Leave a Comment

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