Troubleshoot your calculations by creating a Tableau troubleshooting view! Read the first post in this series to get an overview of the method.

 

Breaking a calculation into its valid sections makes it easier to evaluate whether each piece is returning incorrect values. Incorrect sections warrant further investigation while correct sections can be ignored.

 

Create new calculated fields for valid subsections of the calculation

Create new ad hoc calculation from scratch

  1. Double-click on a shelf
  2. Type or paste the formula

 

Create ad hoc calculation from existing calculation

  1. Highlight a section of a calculation that is valid on its own
  2. Drag the highlighted section to a shelf

 

Create new calculated field

  1. Click the down arrow next to Dimensions in the data pane
  2. Type or paste the formula

 

why: Investigating each section of a calculation means you can narrow your focus. If there are multiple levels of nested functions, consider starting with bigger chucks and working down to smaller sections.

 

Add Sections to the view, remove any expressions that are returning the correct values

  1. Drag a measure to Text on the Marks card, or drag multiple measures to the Measure Values card. See Building a Text Table with Multiple Measures for how to get the Measure Values card.
  2. Drag dimensions to the Rows shelf. You may also consider dragging a dimension to Color on the Marks card depending on your preference.
  3. If a section is returning expected values, then remove it from the view.

 

why: Correct sections are irrelevant to the investigation and can be safely ignored

 

Format the calculation for readability

  • Make a new line for each function or expression
  • Make functions and operators all caps
  • Indent nested functions (You can highlight a block of text and hit Tab)
  • Use comments (Any line beginning with // will be commented out)

 

BeforeAfter

 

why: Seeing the whole calculation without scrolling makes it easier to keep everything in mind. Formatting can also help identify valid sections that can be broken out, and functions or parenthesis that need to be closed.

 

Search Errors

  1. Search the exact text of the error message in Tableau's Knowledge Base

 

Search Tips

  • Remove personalized information from searches, such as field names
  • Wrap phrases in quotations marks to search that exact phrase
  • Can't find documentation on an error? Let us know! We're always working to improve our documentation.

 

why: Tableau will only show results for valid formulas, so errors must be fixed first.

 

Ready for more? Check out steps to Verify the Data. To see it all in action, check the Calculations Survival Guide session at Tableau Conference!