9/27/2016
Tableau Tips - Volume 5
This is the fifth installment of Tableau Tips, offering a few simple tips and tricks in Tableau. Click on images below for full screen
#10 - Create A Horizontal Y-Axis Label
One of the things that always drives me crazy in Tableau is that I can't rotate the y-axis title. This can be achieved by creating a calculated field, but can be done even easier by using an inline formula with the text. Just double click on the blank space in the rows and type the name of the title in quotes. Then remove the default title on the y-axis and you are all set.
#9 - Remove Zero from the Axis
You might have the need to remove the zero from your axis scale. This can be done by formatting the number on the axis in custom formatting. Set the format to $#,#;;#. The semicolon separates the positive; zero; negative numbers. In this case, the formatting of currency with comma is set on the positive number and the zero formatting is blank. This removes the zero completely.
#8 - Move X-Axis for Green Pill
In my previous post Tableau Tips: Volume 3, I demonstrated two methods for moving the X-axis from the bottom of the chart to the top of the chart, but those methods only apply to blue pills (discrete). Here is a quick tip to create and axis across the top for a green pill.
#7 - Copy Sheet After Modification to Save Work
This is one of my favorite tips. I use this one all of the time. You've created a worksheet or you've opened one that is already completed. Then you start modifying things, changing pills, changing the view and you end up with a completely new visualization. Then you realize that you actually want both of them. You can always click the back button to undo your changes, but then you don't have the new worksheet you created. You can't duplicate the sheet because the back button will undo that too. Not to worry, before clicking the undo button, copy your sheet. The back button does not affect your clipboard or sheets that you've copied. Once you've copied the sheet, click the back button until you are back to the original. Once you have the original, then paste the sheet. Now you have the original and the new sheet.
#6 - Copy Sheet Across Workbooks
This is the same process as #7, but you can copy a sheet from one workbook to another. Just make sure you have the same datasource with the same pill names and everything will work great. This is great when collaborating on a project. Multiple people can work in the same datasource creating different visualizations which can be combined later, for example, on a new dashboard.
#5 - Change Tab Color
This is a very simple tip and probably not used enough. Right-click on any tab (worksheet, dashboard, or storypoint) in Tableau and you can set the color. There are seven colors to choose from (and no, they can't be changed in the XML file, I tried). This is a great way to organize tabs, for example by department or topic.
#4 - Copy Dashboard Across Workbooks
Just as we copied a worksheet across workbooks in Tip #6, we can do the same thing with dashboards. When doing this one, you will notice that whatever sheets are used on the dashboard will also be copied to the new workbook. This can be very handy.
#3 - Using Unicodes on Tab Names
Tableau Tips - Volume 4 "Using Unicode Characters in Tableau" was devoted entirely to using Unicode characters, but here's one more tip for tab formatting that is very useful. You can use Unicode characters on the tab names. For example, symbols for indexing the tab numbers or showing something is bad versus good. And since the sheet names default to the chart title you get the added benefit of having them in the title too.
#2 - Expanding Performance Bands
Performance bands are very easy to do in Tableau. Using the Analytics tab, simply drop a Reference Band into the table and set the values for the Band From and Band To. In the example below, I set the bands to go from zero to the maximum value of SUM(Profit). The problem in this case is that the band stops at the maximum and minimum values for Profit. In this case, create a new calculated field for Profit Band and set the equation to [Profit] *1.1. This will set the new field 10% above and 10% below the current Profit. Now add it to Details. Now you can set the bands to go from zero to SUM(Profit Band) and the bands will go past the maximum and minimum points of the data.
#1 - Create Area Chart with Dual Color
This tip comes from a real-world problem. I had a dashboard where I simply wanted to add an area chart showing positive and negative values as a sparkline. The calculation to create the area chart was pretty straight forward, but when trying to color the area chart I realized that Tableau would not actually color the area chart (or line chart) above or below the zero line. I searched online for a few solutions, but the solutions get pretty complicated. I just wanted something quick and easy.
First, duplicate the field. Then set the axis for the top one to start at zero and the one on the bottom to end at zero. This will put the two together. Use Tip#9 above to remove the zero axis. Then use the color on the individual marks cards to color each one separately.
Setting the other ends of the axis to Fixed won't work if you need the chart to be dynamic with your data. If this is the case, then set the other end at Independent if you have data ranges that change in the view.
Update: Ulrik Willemoes pointed out that if you set the axis to Independent then the height won't plot evenly for the positive and negative numbers. For example, if the top range of positive is 1,000 and the lowest point is only -100. Great catch! To solve this I added two calculated fields and use them to set a positive and negative reference line (very similar to Tip #2).
Create calculated fields:
Calculated field name: Max Profit Positive
Formula: abs(sum([Profit]))
Calculated field name: Max Profit Negative
Formula: -(abs(sum([Profit])))
Add the two fields to the Details on the All Marks card. Then add two reference lines. One referencing the Maximum of Max Profit Positive on the top chart and one referencing the Minimum of Max Profit Negative on the bottom chart. Then remove the labels so the reference lines don't adjust with the text label. Set the color of the reference line to match the background color and they will disappear. Using two reference lines will ensure the axis is identical for the top and bottom, making the height of the area consistent for positive and negative values.
I realize this may not work in every case, but it solved what I needed to do so I thought I would share as a tip. This also works for a line chart as well. Notice the default color versus this method that breaks the color above and below the zero line.
I hope you find these tips helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com