At work I am developing a dashboard that contains the following chart:
If you are detailed oriented you will noticed some weird stuff on this chart. Look at the years, look at 2014, 2016 and 2018 gaps. Weird right?
The reason is that this chart is in fact a combination of two floated sheets, one from 2000 to 2016 and another from 2016 to 2021. The specialists never even noticed this, but I do and this really bothers my own quality standards.
So I went back to Tableau and tried another approach on this and I was
surprised happy that it worked like a gem. The graph now looks like this:
Here are the quick steps to create a chart similar to this one:
1. Make use of Sets: The chart uses two both a line and a circle types. So in this first step, create one set for each range of years. I named my sets as 2000-2016 and 2016-2021 (yes 2016 overlaps in both sets)
2.Create a Measure for each Set: Create two calculates fields for each set to grab the values related to those dates. My new measures fields are the following:
IF [2000-2016] THEN [Value %] END
IF [2016-2021] THEN [Value %] END
3.Build the view: Drag Discrete Years into Columns and the two calculated fields into Rows. I also had to add a Year filter so that I could remove the years before 2000, making my chart start where I wanted.
Note: The dataset contained several indicators from IMF’s WEO report. So I also had to throw in filters for the 4 countries sets and the Indicator I was interested (Gross domestic product, constant prices).
So far the view is like this
4.Dual Axis and Synchronize Axis: To make one chart I had to right-click the 2016-2021 % pill and make it a dual-axis chart. Next I right clicked the axis and selected Synchronize Axis. The chart then looked like this:
5.Select chart types: On the second axis I wanted to have circles instead of lines, so I went to the marks card and made my selection. The chart then was closer to what I wanted:
6.Color by Country groups: Next I moved the Country Group Name field to Color card and that created an individual line to each group:
7.Final formatting: Now it was a matter of formatting the chart by…
(1) hiding the axis (right-click on each axis and untick Show header);
(2) hide chart header (right-click Year (date) and use Hide Field Labels for Columns option);
(3) remove grid lines (right-click on the chart and select Format… and clear your Rows lines);
(4) hide the “>64 nulls” at the bottom (right-click on it and select Hide indicator);
(5) format Year (right-click on the Years and select Format… on Dates field select Two-Digit).
The chart was what I wanted it to be:
The learning piece for me is that having critical thinking over your own work is important to find opportunities to improve your skills. A viz is never done until you think it is done. If something bothers you, go after and you will find a better way to accomplish what you want.
If you want to practice, get the workbook on my Tableau Public profile.