Evaluating Multiple Conditions
What if we need to evaluate multiple conditions in our data? The CASE WHEN statement makes this easy by simply adding conditions with additional WHEN clauses. The basic syntax is:
CASE WHEN condition 1 to be evaluated THEN value if true
WHEN condition 2 to be evaluated THEN value if true
WHEN condition 3 to be evaluated THEN value if true
...
ELSE (optional) value if none of the conditions are true
END AS name of segment
Notice that here we mention that the ELSE clause is optional, meaning if every outcome is accounted for with the WHEN clauses, the ELSE clause doesn't need to be included.
As an example, let's imagine that we
Order of CASE WHEN Statements
xxx