Tableau Tuesday: Three Pro-Tips for Calculated Fields

By: Tiffany Spaulding | August 25, 2015

I attended both the NY Tableau User Group (TUG) and NJ TUG this past week. Both events were structured as a "mini viz contest" where attendees broke into teams of 2-3 to compete. We analyzed public data from the New York Health Department, focusing on restaurant code violations across the boroughs. For added learning, we were challenged to incorporate story points, a feature from the Analytics Pane, and a Level of Detail (LOD) calculation.

It was interesting to see the different approaches and solutions to the same data set. As I watched the teams present, the focus of each tended to be centered around what level of detail calculation they chose and why. Presenters would speak to their code and bring up the calc editor on the screen, however most people in the room could not read the tiny font. Having taught Tableau for a few years now, I realized that some tricks I use when teaching are also helpful for dashboard reviews.

Pro-Tip #1: Increase the Font Size in the Calc Editor

When we input calculations into Tableau (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.

Tableau1

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

Option 1: 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.

Tableau2

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.

Tableau3

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.

Tableau4

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.

Tableau5

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.

Tableau6

If you want to learn more skills to make you a better presenter as you demo Tableau, join us at the Boston Tableau User Group tonight (August 25th). I'll be presenting additional Pro-Tips that can translate into nearly any presentation in Tableau or other softwares.

Want to take your Tableau projects to the next level? Learn more about how our experts can help grow your skills today.

Helping you viz smarter, one Tuesday at a time. Have a great day!

Categories:Tableau, Data Visualization