Home > Tableau > Tableau Cannot use boolean type in IF expression

Tableau Cannot use boolean type in IF expression

November 18th, 2016 Leave a comment Go to comments

The “Cannot use boolean type in IF expression” error in Tableau calculated fields is quite self-explanatory. You’re not able to use fields that return true or false (i.e. boolean type) with IF statements in Tableau.

However there is a workaround. In many programming languages True or False can be represented as 1 or 0. Tableau recognises 1 and 0 as integers – therefore the way to get around the boolean type error is to wrap the boolean fields in INT().

For example create a simple calculated field with the formula 1=1, which is a boolean type.

Tableau boolean field

Next create a calculated field with an IF statement using the field, deliberately creating the Cannot use boolean type error.

Cannot use boolean type error

Converting the boolean field to an integer will remove this error.

Valid Tableau IF statement

Categories: Tableau Tags:
  1. January 4th, 2017 at 12:24 | #1

    thanks for sharing the info. please keep on sharing the useful information about the tableau

  1. No trackbacks yet.