0
0
Tableaubi_tool~10 mins

Logical functions (IF, IIF, CASE) in Tableau - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to return 'High' if Sales is greater than 1000.

Tableau
IF [Sales] [1] 1000 THEN 'High' ELSE 'Low' END
Drag options to blanks, or click blank then click option'
A<=
B<
C=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' will check the wrong condition.
Using '=' will check for equality, not greater than.
2fill in blank
medium

Complete the IIF function to return 'Yes' if Profit is positive, otherwise 'No'.

Tableau
IIF([Profit] [1] 0, 'Yes', 'No')
Drag options to blanks, or click blank then click option'
A<=
B>
C<
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' will include zero and negative profits incorrectly.
Using '=' checks only if Profit equals zero.
3fill in blank
hard

Fix the error in the CASE statement to categorize Region correctly.

Tableau
CASE [Region] WHEN 'East' THEN 'East Coast' WHEN 'West' [1] 'West Coast' ELSE 'Other' END
Drag options to blanks, or click blank then click option'
AIF
BELSE
CTHEN
DWHEN
Attempts:
3 left
💡 Hint
Common Mistakes
Using ELSE instead of THEN after WHEN causes syntax errors.
Using IF inside CASE is incorrect syntax.
4fill in blank
hard

Fill both blanks to create a CASE statement that returns 'Low', 'Medium', or 'High' based on Sales.

Tableau
CASE WHEN [Sales] [1] 500 THEN 'Low' WHEN [Sales] [2] 1500 THEN 'Medium' ELSE 'High' END
Drag options to blanks, or click blank then click option'
A<=
B>
C<
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' in the first condition would exclude 500 from 'Low'.
Using '>=' in the second condition would misclassify values.
5fill in blank
hard

Fill all three blanks to create an IIF nested function that returns 'Profit', 'Loss', or 'Break-even' based on Profit value.

Tableau
IIF([Profit] [1] 0, 'Profit', IIF([Profit] [2] 0, 'Loss', [3]))
Drag options to blanks, or click blank then click option'
A>
B<
C'Break-even'
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '>' or '<' will not cover all cases correctly.
Forgetting to put quotes around 'Break-even' causes errors.