Bird
Raised Fist0
Tableaubi_tool~20 mins

Creating calculated fields in Tableau - Practice Exercises

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Calculated Fields Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
dax_lod_result
intermediate
2:00remaining
Calculate Total Sales per Region using LOD Expression
You have a sales dataset with fields: [Sales], [Region], and [Date]. You want to create a calculated field that shows the total sales for each region regardless of the date filter applied. Which Tableau LOD expression will correctly calculate this?
A{FIXED [Region] : SUM([Sales])}
BSUM([Sales])
C{EXCLUDE [Region] : SUM([Sales])}
D{INCLUDE [Region] : SUM([Sales])}
Attempts:
2 left
💡 Hint
Think about how to fix the calculation at the region level ignoring other filters.
visualization
intermediate
2:00remaining
Identify the Correct Visualization for a Calculated Profit Ratio
You created a calculated field in Tableau called Profit Ratio defined as SUM([Profit]) / SUM([Sales]). Which visualization best shows the profit ratio by product category with clear comparison?
APie chart showing total sales by product category
BLine chart showing profit ratio trend over time
CStacked bar chart showing profit and sales side by side
DBar chart with product categories on the x-axis and profit ratio on the y-axis
Attempts:
2 left
💡 Hint
You want to compare profit ratios across categories clearly.
data_modeling
advanced
2:30remaining
Create a Calculated Field to Show Year-over-Year Sales Growth
You have a dataset with [Sales] and [Order Date]. You want to create a calculated field in Tableau that shows the percentage growth of sales compared to the previous year. Which formula correctly calculates this?
A(SUM([Sales]) - LOOKUP(SUM([Sales]), -1)) / LOOKUP(SUM([Sales]), -1)
B(SUM([Sales]) - ZN(LOOKUP(SUM([Sales]), -1))) / ZN(LOOKUP(SUM([Sales]), -1))
C(SUM([Sales]) - LOOKUP(SUM([Sales]), 1)) / LOOKUP(SUM([Sales]), 1)
D(SUM([Sales]) - PREVIOUS_VALUE(SUM([Sales]))) / PREVIOUS_VALUE(SUM([Sales]))
Attempts:
2 left
💡 Hint
Consider handling null values for the first year.
🔧 Formula Fix
advanced
2:00remaining
Identify the Error in This Calculated Field for Average Sales
You wrote this calculated field in Tableau to find average sales per customer: SUM([Sales]) / COUNTD([Customer ID]). However, the result is incorrect when filters are applied. What is the main reason?
Tableau
SUM([Sales]) / COUNTD([Customer ID])
AThe calculation does not use FIXED LOD, so filters affect numerator and denominator differently.
BCOUNTD cannot be used in calculated fields.
CSUM([Sales]) should be replaced with AVG([Sales]) for average calculation.
DThe formula needs to use WINDOW_SUM instead of SUM.
Attempts:
2 left
💡 Hint
Think about how filters affect aggregation in numerator and denominator.
🎯 Scenario
expert
3:00remaining
Design a Calculated Field to Flag Top 10% Customers by Sales
You want to create a calculated field in Tableau that flags customers whose total sales are in the top 10% of all customers. Which formula correctly creates this flag?
AIF PERCENTILE(SUM([Sales]), 0.9) THEN 'Top 10%' ELSE 'Others' END
BIF RANK_PERCENTILE(SUM([Sales])) <= 0.1 THEN 'Top 10%' ELSE 'Others' END
CIF RANK_PERCENTILE(SUM([Sales])) >= 0.9 THEN 'Top 10%' ELSE 'Others' END
DIF WINDOW_PERCENTILE(SUM([Sales]), 0.9) THEN 'Top 10%' ELSE 'Others' END
Attempts:
2 left
💡 Hint
Remember that top 10% means percentile rank greater than or equal to 0.9.

Practice

(1/5)
1. What is the main purpose of creating a calculated field in Tableau?
easy
A. To change the color of a chart
B. To import data from external sources
C. To create new data values based on existing data using formulas
D. To delete rows from the data source

Solution

  1. Step 1: Understand what calculated fields do

    Calculated fields allow you to create new data by applying formulas to existing data.
  2. Step 2: Compare options to this definition

    Only To create new data values based on existing data using formulas describes creating new data values using formulas, which matches the purpose of calculated fields.
  3. Final Answer:

    To create new data values based on existing data using formulas -> Option C
  4. Quick Check:

    Calculated fields = new data from formulas [OK]
Hint: Calculated fields create new data from old data using formulas [OK]
Common Mistakes:
  • Confusing calculated fields with data import
  • Thinking calculated fields change visuals only
  • Assuming calculated fields delete data
2. Which of the following is the correct syntax to create a calculated field that adds 10 to the value of the field Sales?
easy
A. SUM(Sales) + 10
B. [Sales] + 10
C. {Sales} + 10
D. Sales + 10

Solution

  1. Step 1: Recall Tableau field reference syntax

    In Tableau, fields are referenced inside square brackets like [Sales].
  2. Step 2: Check each option's syntax

    [Sales] + 10 uses [Sales] + 10, which is correct. Sales + 10 misses brackets, C uses curly braces which are incorrect here, and A uses aggregation which is not needed for simple addition.
  3. Final Answer:

    [Sales] + 10 -> Option B
  4. Quick Check:

    Field names need brackets in formulas [OK]
Hint: Use square brackets around field names in formulas [OK]
Common Mistakes:
  • Omitting square brackets around field names
  • Using curly braces instead of brackets
  • Adding aggregation unnecessarily
3. Given the calculated field formula IF [Profit] > 0 THEN 'Profit' ELSE 'Loss' END, what will be the result for a record where [Profit] is -50?
medium
A. 'Loss'
B. 'Profit'
C. 50
D. Error

Solution

  1. Step 1: Understand the IF condition

    The formula checks if [Profit] is greater than 0. If yes, returns 'Profit', else returns 'Loss'.
  2. Step 2: Apply the condition to the value -50

    Since -50 is not greater than 0, the ELSE part applies, so the result is 'Loss'.
  3. Final Answer:

    'Loss' -> Option A
  4. Quick Check:

    Profit > 0? No, so 'Loss' [OK]
Hint: Check IF condition carefully for each value [OK]
Common Mistakes:
  • Confusing greater than with less than
  • Expecting numeric output instead of text
  • Ignoring ELSE clause
4. Identify the error in this calculated field formula: IF [Sales] > 1000 THEN 'High' ELSE 'Low'
medium
A. Incorrect use of square brackets around Sales
B. No error, formula is correct
C. Using text values instead of numbers
D. Missing END keyword to close IF statement

Solution

  1. Step 1: Review IF statement syntax in Tableau

    Tableau IF statements must end with the keyword END to close the block.
  2. Step 2: Check the given formula

    The formula lacks the END keyword at the end, so it will cause a syntax error.
  3. Final Answer:

    Missing END keyword to close IF statement -> Option D
  4. Quick Check:

    IF statements need END keyword [OK]
Hint: Always end IF statements with END [OK]
Common Mistakes:
  • Forgetting END keyword in IF formulas
  • Misplacing square brackets
  • Confusing text and numeric outputs
5. You want to create a calculated field that categorizes sales into three groups: 'Low' for sales below 500, 'Medium' for sales between 500 and 1000, and 'High' for sales above 1000. Which formula correctly implements this?
hard
A. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] <= 1000 THEN 'Medium' ELSE 'High' END
B. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] < 1000 THEN 'Medium' ELSE 'High' END
C. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] < 1000 THEN 'Medium' ELSEIF [Sales] > 1000 THEN 'High' END
D. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] <= 1000 THEN 'Medium' ELSEIF [Sales] > 1000 THEN 'High'

Solution

  1. Step 1: Understand the sales ranges

    Sales below 500 = 'Low', 500 to 1000 inclusive = 'Medium', above 1000 = 'High'.
  2. Step 2: Check each formula for correct conditions and syntax

    IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] <= 1000 THEN 'Medium' ELSE 'High' END correctly uses ELSEIF with <= 1000 for 'Medium' and ends with END. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] < 1000 THEN 'Medium' ELSE 'High' END excludes 1000 from 'Medium'. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] < 1000 THEN 'Medium' ELSEIF [Sales] > 1000 THEN 'High' END has an extra ELSEIF but no final ELSE. IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] <= 1000 THEN 'Medium' ELSEIF [Sales] > 1000 THEN 'High' misses END keyword.
  3. Final Answer:

    IF [Sales] < 500 THEN 'Low' ELSEIF [Sales] <= 1000 THEN 'Medium' ELSE 'High' END -> Option A
  4. Quick Check:

    Ranges inclusive and END keyword correct [OK]
Hint: Use ELSEIF and END; include boundary with <= for ranges [OK]
Common Mistakes:
  • Missing END keyword
  • Incorrect boundary conditions (e.g., excluding 1000)
  • Using multiple ELSEIF without final ELSE