Tableau Desktop Certified Associate: Exam Guide
by Dmitry Anoshin, JC Gillet, Fabian Peri, Radhika Biyani, Gleb Makarenko
Case statements
Case statements make use of the following syntax: CASE <expression> WHEN <value1> THEN <return1> WHEN <value2> THEN <return2> ... ELSE <default return> END.
In case statements, the value of the expression is matched to each of the values and whenever a match is found, the return value corresponding to it is returned. If no value matches the expression, then the default else value is returned. If there is no default value, null values will be returned.
Case statements are very useful when you have to compare the same expression against multiple values. An example would be if we wanted to assign numbers to some of the markets. We can create a calculation as shown in the following screenshot:
Now, if we place both Market and ...
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