Tableau Cannot use boolean type in IF expression

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

2018-02-14T14:08:13+00:00 November 18th, 2016|Tableau|

2 Comments

  1. Hyderabad Tableau 2017-01-04 at 12:24 - Reply

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

  2. Sonu Pandey 2017-12-01 at 07:33 - Reply

    Thanks it works for me.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.