
Case v If-Then-Else Logic, When to Use Them, How They Differ
The most common type of logical test capability comes in the form of If-Then-Else logic,
typically found in most standard
software programs.
Tableau calculated fields at minimum, require use of
IF, THEN, and END
keywords. ELSE and ELSEIF
keywords are required only for multi-condition tests.
A modified form of test logic uses the CASE/WHEN/THEN/END construct (the ELSE keyword
is only required if a "catch all"
result is desired). Similar to IF/THEN/ELSE logic,
CASE logic tests a single field or expression and returns different results
for each
condition. In some cases, IF/THEN/ELSEIF/END will be required if multiple tests are needed.
However, for a single
test with many results, CASE logic may be easier to read and modify.
Case and If/Then/Else are powerful Tableau logic constructs.
Learn more about Case and If/Then/Else in Tableau 8: The Official Guide.
See
how
Case and If-Then-Else differ on our YouTube channel.
Download Tableau Desktop today.
Get more information about Ablaze Group Tableau Training, email us today!
Ablaze Group services and resources:
TABLEAU TRAINING - Training Certified by Tableau!
TABLEAU CONSULTING
Tableau 9: The Official Guide, by Ablaze Group's George Peck.
ablazegroup.com