Open In App

Logical Functions in Tableau

In this article, we will learn about logical functions and it’s used in Tableau. For this first look into two terms :

Let’s discuss every logical function one by one with an example. Dataset used in the given examples is Dataset.



AND Function: The AND Function is employed to see multiple expressions. The syntax of the AND Function is as shown below:

Expression_1 AND Expression_2

If both the conditions are True, it returns True. Otherwise, it returns False.



OR Function: The Tableau OR function is like an either-or statement in English. If both the conditions are False, Tableau or will return False; otherwise, it returns True. The syntax of this Tableau OR Function is:

Expression_1 OR Expression_2

IIF Function: The Tableau IIF function is that the simple version of the If Else Function. If both the condition is True, then it’ll return First Statement otherwise, the second statement. The syntax of this Tableau IIF Function is:

IIF(Expression, True_statement, False_Statement)

NOT Function: The Tableau NOT function return the exact opposite. I mean, True will become false and vice versa. The syntax of this Tableau NOT Function is:

NOT(Expression)

ISNULL Function: Tableau ISNULL function will check whether it is NULL or Not. If it’s NULL, then it returns TRUE; otherwise, False will return. The syntax of the Tableau ISNULL Function is:

ISNULL(Expression)

ZN Function: Tableau ZN function will return the first values of Not Null values, and 0 for Null values. In simple English, ZN in Tableau is employed to exchange the NULL values with 0. The syntax of the Tableau ZN Function is:

ZN(Expression)

IFNULL Function: Tableau IFNULL function is employed to exchange the NULL values together with your own. The syntax of the Tableau IFNULL Function is:

IFNULL(Expression, Value)

IF Function: Tableau If Function is one of the foremost useful decision-making functions. If the function tests the condition and depending upon the condition result, it’ll return the output.

IF <Expression1> THEN <Statement1>
ELSEIF <Expression2> THEN <Statement2>
ELSEIF <Expression3> THEN <Statement3>
.....
ELSEIF <ExpressionN> THEN <StatementN>
ELSE <Statement>
END

IF-END

IF-ELSE-END

IF-ELSEIF-ELSE-END

Case Function: Case Function is the part of Logical functions in Tableau. These functions are used to perform the logical test and return the required value when the test expression is true.

CASE [<expression>]
    WHEN <expression> THEN <expression>
    WHEN <expression> THEN <expression>
    ELSE <expression>
END

Article Tags :