0
0
Tableaubi_tool~20 mins

Logical functions (IF, IIF, CASE) in Tableau - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Logical Functions Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
dax_lod_result
intermediate
2:00remaining
Output of nested IF statement in Tableau calculated field
Consider this Tableau calculated field:
IF [Sales] > 1000 THEN 'High' ELSEIF [Sales] > 500 THEN 'Medium' ELSE 'Low' END

What will be the result for a record where Sales = 750?
Tableau
IF [Sales] > 1000 THEN 'High' ELSEIF [Sales] > 500 THEN 'Medium' ELSE 'Low' END
A'High'
BNULL
C'Low'
D'Medium'
Attempts:
2 left
💡 Hint
Think about the order of conditions and which one matches first.
visualization
intermediate
2:00remaining
Best visualization to show CASE statement categories
You have a calculated field using CASE to categorize customers by region:
CASE [Region]
WHEN 'East' THEN 'Group 1'
WHEN 'West' THEN 'Group 2'
ELSE 'Group 3'
END

Which visualization best shows the count of customers in each group?
AScatter plot of customer age vs sales
BLine chart showing customer count over time
CPie chart showing percentage of customers per group
DText table listing customer names
Attempts:
2 left
💡 Hint
Think about how to show parts of a whole clearly.
🧠 Conceptual
advanced
2:00remaining
Difference between IF and IIF in Tableau
Which statement correctly describes the difference between IF and IIF functions in Tableau?
AIF is only for numeric comparisons, IIF is for text comparisons
BIIF evaluates both true and false parts always, IF evaluates only the matching part
CIIF can only be used inside calculated fields, IF cannot
DIF returns a Boolean, IIF returns a string
Attempts:
2 left
💡 Hint
Consider how each function processes its arguments.
🔧 Formula Fix
advanced
2:00remaining
Identify error in CASE statement syntax
What error will this Tableau calculated field produce?
CASE [Category]
WHEN 'A' THEN 1
WHEN 'B' THEN 2
ELSE 3
Tableau
CASE [Category]
WHEN 'A' THEN 1
WHEN 'B' THEN 2
ELSE 3
ASyntax error: missing END keyword
BRuntime error: invalid ELSE clause
CNo error, runs correctly
DType error: mixing string and number
Attempts:
2 left
💡 Hint
Check if the CASE statement is properly closed.
🎯 Scenario
expert
3:00remaining
Using nested logical functions for complex categorization
You want to create a calculated field in Tableau that categorizes sales performance as:
- 'Excellent' if Sales > 1000 and Profit > 200
- 'Good' if Sales > 1000 and Profit ≤ 200
- 'Average' if Sales ≤ 1000 and Profit > 100
- 'Poor' otherwise

Which calculated field expression correctly implements this logic?
ACASE WHEN [Sales] > 1000 AND [Profit] > 200 THEN 'Excellent' WHEN [Sales] > 1000 AND [Profit] <= 200 THEN 'Good' WHEN [Sales] <= 1000 AND [Profit] > 100 THEN 'Average' ELSE 'Poor' END
BIF [Sales] > 1000 THEN IF [Profit] > 200 THEN 'Excellent' ELSE 'Good' END ELSEIF [Profit] > 100 THEN 'Average' ELSE 'Poor' END
CIIF([Sales] > 1000, IIF([Profit] > 200, 'Excellent', 'Good'), IIF([Profit] > 100, 'Average', 'Poor'))
DIF [Profit] > 200 THEN 'Excellent' ELSEIF [Sales] > 1000 THEN 'Good' ELSEIF [Profit] > 100 THEN 'Average' ELSE 'Poor' END
Attempts:
2 left
💡 Hint
Check that all conditions match the exact logic and order.