Skip to main content

Posts

Showing posts from October, 2022

Tableau Case Statement

Tableau Case Statement The CASE function evaluates  expression , compares it to a sequence of values,  value1 ,  value2 , etc., and returns a result.  When a value that matches  expression  is encountered, CASE returns the corresponding return value. If no match is found, the default return expression is used. If there is no default return and no values match, then Null is returned. CASE is often easier to use than IIF or IF THEN ELSE. Typically, you use an IF function to perform a sequence of arbitrary tests, and you use a CASE function to search for a match to an expression. But a CASE function can always be rewritten as an IF function , although the CASE function will generally be more concise. Many times you can use a group to get the same results as a complicated case function. Syntax: CASE <expression>  WHEN <value1> THEN <return1>  WHEN <value2> THEN <return2> ... E LSE <default return>  END Examples: CASE [Region] WHEN 'West' THEN 1 W