Skip to main content

Posts

Showing posts with the label #caseTableau

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 Case statement

Tableau Case statement Create Tableau Case statement using a measure and a dimension: CASE [Age Group] WHEN 'm_13_17' THEN [Mf Count] WHEN 'm_18_24' THEN [Mf Count] WHEN 'm_25_34' THEN [Mf Count] WHEN 'm_35_44' THEN [Mf Count] WHEN 'm_45_54' THEN [Mf Count] WHEN 'm_55_64'  THEN [Mf Count] WHEN 'm_55_64' THEN [Mf Count] END Or Otherwise use the IF statement as below: IF CONTAINS([Reporting Platform], 'facebook') THEN 'Facebook' ELSEIF CONTAINS([Reporting Platform], 'instagram') THEN 'Instagram' ELSEIF CONTAINS([Reporting Platform], 'facebook') AND CONTAINS([Reporting Platform], 'instagram') THEN 'Both' ELSE 'Other' OR better one below: IF  [Total Delay Mins]>=6 AND [Total Delay Mins]<=10 THEN "6 to 10 Minutes" ELSEIF   [Total Delay Mins]>10 AND  [Total Delay Mins]<=15 THEN "10 to 15 Minutes" ELSEIF [Total Delay Mi...