When you're new to Tableau or working on complex calculations it's easy to get circular in your thoughts.  Here are some tips and tricks that I use to help organize my thoughts when creating calculations.

Create a Crosstab

When I don't know how to write the calculation I like to start with a crosstab rather than trying to visualize the data right away.  In my crosstab I add all of the fields in my calculation that way it's easy to verify that the calculation is correct.

If the calculation is especially complex it's helpful to separate the calculation into each part and troubleshoot in sections.

Use Calculated Field Comments

You can add comments to your calculated fields by adding two backslashes "//" at the beginning of each line.  I use comments to add notes about a calculations such as logic or thought process.  These types of notes make it easy to handoff a workbook to its predecessor or can be helpful to yourself when you re-visit the workbook.

Another way to use comments is to comment out my failed attempts.  Eventually after many tries and possibly days you'll come back to an idea that you already had or you'll forget if you tried something perviously.  Using comments to keep log of failed attempts will help you stay organized.

Add Comments to the Comment Field

The comment field shows up when you hover over a measure in the data pane.  These comments are helpful because the measure's name (what show's up on the sheet) isn't always descriptive enough for the developer to know what the field is specifically used for.  The comment section can be used as a data dictionary to display metadata.


Use Excel for Long Manual Calculations

When you have long manual calculations such as custom groups you can use Excel instead of copying and pasting each line in the Tableau calculation dialog window.

Research for Calculation Solutions

The Tableau forums and bloggers are great resources for calculations.  Check out this Tableau Reference guide by Jeff Schaffer which a specific calculations section or Jonathan Drummey's Tableau Wiki with a table calculations section and level of detail section!


Post a Comment