Sometimes, when values are bunched together high up an axis, it can be helpful to exclude zero from the axis in order to reveal the finer detail. While this might not be data viz best practice, there are occasions where it can help as long as it is handled correctly, as Stephanie Evergeen's excellent blog post highlights.
Whatever your stance on non-zeroing* your axes, it is possible to use Tableau parameters to provide choice to your audience.
For this example I am using the Sample EU Superstore data set, displaying the top 5 countries with the highest average Discount, by Year of Order Date, which gives me:
Now clearly I can right click on the y-axis, Edit Axis and untick 'Include zero'. That's straightforward:
However, if I publish this I am forcing my (potentially questionable) design choice onto my audience. I can mitigate that with a suitable comment in the title but providing choice is surely the best compromise here.
Firstly, let's create a new Boolean parameter to provide this choice:
Now create a calculated field that will either display our measure (Average Discount) or display the value zero, depending on the value selected in the parameter:
We can then bring this calculated field into Rows to create a secondary line chart next to the existing Average Discount display, format the axis to Dual Axis and synchronise the axis so that both charts are exactly overlaid.
Then format the primary axis to exclude zero and hide the redundant secondary axis by unticking Show Header.
The result is a non-zeroed** y-axis but when the parameter is set to 'Include Zero' a zero value is plotted courtesy of the calculated field. Setting the Parameter to 'Exclude Zero' effectively hides this by plotting it exactly over our primary measure.
Of course, we don't want to see the secondary measure - it is only there to stretch the y-axis range to zero, not to provide any visual data - and so some further tidying up is required to hide this as best as possible. On the secondary axis's marks card only:
- Change the display type to Circle.
- on Colour, move any dimensions here from Colour to Detail. Set the transparency to 0% which hides the points from view unless you hover of them.
- on Size, change this to the smallest possible.
- remove the Label
- remove the Tooltip contents
This makes the secondary axis points almost invisible - only a small point is visible on hover or select.
And that should be that. Example workbook attached. And my first blog post done. Ta da.
If there is an easier way of achieving the same result (and bearing in mind I am using v9.0.3 at the time of writing - not my choice!) then do let me know - I'm very happy to be out-tipped!
* This probably isn't a word
** Neither is this