ad

Tableau Tuesday: Three Pro-Tips for Calculated Fields

Contributor & Author: Tiffany Spaulding
Reference: Click Here


Pro-Tip #1: Increase the Font Size in the Calculator Editor:
When we start writing calculations into Tableau Calculation editor window (Right click in data window --> Create Calculated Field), Tableau defaults to a font size around 10pt. The font size is sufficient as we design sitting close to our PC screen, however it appears small when we project in front of a larger audience. Have no fear; we can increase the font size. This was very intuitive in 8.1; however in versions 8.2 and 8.3, it became a bit more difficult if you didn't have a numeric keypad on your keyboard. Now, 9.0 brought back the intuitive options 8.1 had (high five to whatever developer at Tableau heard my plea!).

Tableau Desktop 8.1:
Option 1: Hold CTRL key and then roll the scroll wheel on your mouse.
Option 2: Hold CTRL key and then use [+] or [-] on 10 key pad.
Note: CTRL + [+] or [-] on a regular keyboard does not work.

Tableau Desktop 8.2 & 8.3:
The ability to utilize CTRL plus the scroll wheel was removed from 8.2 and 8.3. The only option to zoom in on the text is to utilize the CTRL key plus [+] and [-] from the num key pad. CTRL plus [-] on the regular keyboard will still decrease the font size, however if you try CTRL with [+], you'll end up with [=] in your code.

Tableau Desktop 9.0:
Option1: Hold CTRL key and then roll the scroll wheel on your mouse.
Option 2: Hold CTRL key and then use [+] or [-] on keyboard or on 10 key pad.

I go back and forth between all four versions each week depending on what version a client is using. To keep it easy, here is a cheat sheet to remember how to zoom in each version of the tool. 

Increasing Font in Calculation Editor in Tableau Desktop:
Version
Increase Font
Decrease Font
8.1
CTRL + Scroll forward
or
CTRL + [+]   <--Num keypad only
CTRL + Scroll backward
or
CTRL + [-]   <--Num keypad only
8.2
CTRL + [+]   <--Num keypad only
CTRL + [-]  
8.3
CTRL + [+]   <--Num keypad only
CTRL + [-]  
9.0
CTRL + Scroll forward
or
CTRL + [+]
CTRL + Scroll backward
or
CTRL + [-]

Pro-Tip #2: Annotate Your Calculation Code to Explain the Logic to Others:
As we design in Tableau Desktop, we become intimately familiar with the data set and logic behind each calculation. Eventually we share our work with others though. Pass on the logic you used to build each calculation by adding annotations inside the code of your calculation. Any line of code in the calc editor that begins with a // will appear in a faded teal font and not be considered when Tableau computes the calculation. You can annotate anywhere in the calc, including in line with other arguments in the code. To end the annotation, press return and you are back to normal coding.

Pro-Tip #3: Add Comments to the Field:
Each of the previous two Pro-Tips still require going into the Calculated Field Editor (right click on calculated field in data window --> Edit Calculated Field). To save time for both you and future editors of the workbook, you can copy the code of the calculation and paste it as a comment of the field. When you hover your mouse over the field in the data window, you'll be able to see the calculation logic and annotations without having to enter the calc editor.
To begin, open your calculated field and copy the code:
  1. Right click on the calculated field in the data window --> Edit Calculated Field.
  2. Highlight over the code.
  3. CTRL + C to copy the code.

Next, add the code as a comment to the field:
4. Right click on the calculated field in the data window --> Default Properties --> Comment.
5. CTRL + V to paste the formula into the Comment Editor.
6. Press OK to close the Comment Editor.
7. To check your work, hover your mouse over the calculated field in the data window. The comment should appear the same way a tooltip appears for a mark in view.

Take it one step further and clean up your code (remove //). You can even color encode the text to still pass on the logic of function, field, and parameter by coloring with blue, orange, and purple respectively. If you will be presenting to a larger room, I recommend increasing the font size as well.