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.
Next create a calculated field with an IF statement using the field, deliberately creating the Cannot use boolean type error.
Converting the boolean field to an integer will remove this error.