Skip to main content

Posts

Showing posts with the label #case

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>  EN...

Tableau Logical Functions

Tableau Logical Functions Why do we use logical calculations? Logical calculations allow you to determine if a certain condition is true or false (boolean logic). For example, you might want to quickly see if sales for each country you distribute your merchandise to were above or below a certain threshold. Function Syntax Description IN <expr1> IN <expr2> Returns TRUE if any value in <expr1> matches any value in <expr2>. The values in <expr1> can be a Set, list of literal values, or a combined field. Examples: SUM([Cost]) IN (1000, 15, 200) [SET] IN [COMBINED FIELD] AND IF <expr1> AND <expr2> THEN <then> END Performs a logical conjunction on two expressions. Example: IF (ATTR([Market]) = "Africa" AND SUM([Sales]) > [Emerging Threshold] )THEN "Well Performing" CASE CASE <expression> WHEN <value1> THEN <return1> WHEN <value2> THEN <return2> ... ELSE <default return> END Pe...