Tableau Desktop Certified Associate: Exam Guide
by Dmitry Anoshin, JC Gillet, Fabian Peri, Radhika Biyani, Gleb Makarenko
IF statement
An IF statement has the following syntax: IF <expr> THEN <then> [ELSEIF <expr2> THEN <then2>...] [ELSE <else>] END.
Using an IF statement, we can test a series of conditions, and based on whether the condition is true, the values are returned; otherwise, the next condition is tested. This continues until no condition is true, in which case, the default condition's value is represented; otherwise, it is returned. If there is no default condition, then null is returned.
Within IF statements, multiple conditions can also be combined using OR and AND operators.
For example, if we wanted to group sales into categories of high, medium, and low, we could create a calculation such as the following:
Here, you can see we have grouped ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access