Common Calculated Field Errors in Tableau

by Kristine Wiesner

Here are some common calculated field errors one can encounter while starting to learn Tableau.

1. "Cannot mix aggregate and non-aggregate arguments with this function"

This is probably the most common error that we encounter.  This function in Tableau requires the same level of granularity in an expression.  Here, Profit represents a row-level granularity, a single value,  while Sales is in the group level with multiple values.   This can be easily resolved by bringing them both in the same logical level.  In this case should be a group level since ratios are typically computed in this level.  By adding a SUM function on profit, this calculation is valid.

2. "Cannot divide / add / multiply / subtract  float value by string value"

This calculation error is common when performing mathematical operations on different data types.  Here, in our example a float is divided with a string.  This can be resolved by type casting or convert string into numeric value or vice versa, but it has to be meaningful or logical.  The point is to make sure both are of the same data types before doing the operation.

3.  "Expected 'END' to match 'IF' at character 0"

This error is easy to miss when we are using IF Statements in calculation.   IF Statements must always have an END clause.

4. "Unterminated String"

This one is also easy to miss, and sometimes hard to detect.  Unterminated string means there is an string started with a quote or double quote somewhere in the code but not closed.  There should be a another pair of quotation mark that will close the string.  In the example,  "Other Region" just needs the double quote.

5. "Syntax Error (maybe you are missing an identifier)"

Here's another common error in calculated field where there is a missing argument in the line of code.  In the example, it was not specified what Tableau will return when the first expression is not satisfied.  So we can put "Non-Profitable" to resolve this  error.

These are few among the many errors I've encountered in Tableau.  And you can learn to resolve other errors by simply experiencing or going through it.  Also Tableau's help guide and community have many references for this.  Last but not the least there are also multitude of resources in Data School blogs and Convo Posts.   And if you really feel you have exhausted all resources to search for solution, simply shout out in Convo and 99.99% someone will jump in to help you out.

Kristine Wiesner

Wed 01 Mar 2023

Fri 29 Jul 2022

Mon 25 Jul 2022

Mon 11 Jul 2022