top of page
Writer's pictureV Ramasita B

Bar in bar chart with rounded edges in Tableau



Bar charts are widely used to visualize category-wise data of the dataset. The length of the bar represents the value of that category it represents. In a tableau, we can create many variations to the simple bar charts and also use for complex comparisons of data. Stacked bar charts, side by side bar charts, bar in bar charts these are a few variations. In this blog, I am covering the bar charts which are used to compare values across multiple dimensions.

Stacks bars in stacked bar chart represents different groups of categories on top of each other. The bar height represents the combined result of the groups. These are used to compare values across multiple dimensional fields.

In side-by-side bar chart, there are two or more bars for each categorical group. The bars are color-coded in order to characterize a specific group. These are used to compare values across multiple dimension fields when distribution of values across both dimensions are important.

Bar in bar chart, two measures are shown in the same chart, one nested within the other. These are used to compare two or more measure fields across same dimension field. It puts all metrics into prospective and finds clues on where to analyze further. For example, this year’s sales vs last year’s sales or this year’s sales Vs profit.

we can create a bar in bar chart by two methods.

For creating this chart we are using sample superstore dataset which is widely used. we are comparing 2015-year sales with 2016-year sales by subcategory wise.

Method 1: if we have two measures then we can create the bar in bar chart by following method.

step1: Connect to the sample superstore dataset. Then create two calculated fields as 2015yr.sales and 2016yr.sales.


step2: Then drag subcategory into rows and 2015yr.sales, 2016yr.sales into columns. Drag one of the measures, 2016yr.sales on top of existing axis of other measure i.e., 2015yr.sales. This will create a shared axis bar chart. Change its Entire view from the standard view.



step3: Now drag Measure Names from rows into the color. Now drag Measure Names into varying size card by holding Ctrl key.



step4: Tableau by default will stack all the marks. To unstack, go to the Analysis menu at the top. we have a stack marks option. click on that and turn it off. Now the bars are on the same baseline.


step5: Go to the size legend and click on sort and select descending. This will create 2016 sales on top of 2015 sales. Now final bar chart in bar will appear like this.


Method 2: Year as a discrete dimension.

we take discrete dimension in filter to compare two years of sales, 2015 and 2016, subcategory-wise.

step 6: Drag subcategory onto rows and sales into columns. Drag order date into filters and chose years and click next and chose 2015 & 2016.

we take discrete dimension in filter to compare two years of sales, 2015 and 2016, subcategory -wise.


step7: Now drag order date on color and also Varying size card. change quarterly to year.


step8: Go to stacking marks in Analysis menu and Turn Off stacking. Go to the size legend and click on sort and select descending. This will make 2016 sales on top of 2015 sales. Now the final bar chart in bar will appear like this.

A different way to represent simple bar is making its square edges to rounded. It gives different look and flavor. Adding rounded edges to the bar chart makes appealing and attractive to the end users.

step9: Now we have to take another measure with zero value. There are many ways to achieve this. I am taking Avg(0) by typing it in the column and press enter.

step10: Now make shared axis chart by dragging AGG(Avg(0)) unto sales axis. Now the Measure Names column appear in the Rows.

step11: Now change the chart Type to line Under Marks.


step12: Now drag Measure Names in the Rows to the path. Now go the Format by clicking on the chart. Remove grid lines and zero lines. Then resulting final chart looks as show below.

Now drag measure names in the rows to the path. Now go to the format by clicking on the chart. Remove grid lines and zero lines. The resulting final chart looks as shown below.

Summary: we saw different bar charts to represent complex comparison of data. side by side bar charts are great for comparing one measure across multiple dimensions, but we can’t compare two measures. Stack bars are great for showing cumulative values, but not great for comparing individual segments. Bar in bar charts able to compare two measures or one measure against a target easily.

3 views0 comments

Comments


bottom of page