TCC Calculations and Expressions 2 — Questions and Answers
Question 1: What is the primary functional difference between a calculated field and a parameter in Tableau?
- Calculated fields can reference parameters, but parameters cannot reference calculated fields
- Parameters are static, user-controlled input values while calculated fields are dynamic expressions evaluated against data (Correct answer)
- Calculated fields support only numeric data while parameters support all data types
- Parameters are stored in the data source while calculated fields exist only in workbooks
Correct answer: Parameters are static, user-controlled input values while calculated fields are dynamic expressions evaluated against data
Parameters hold a single user-selected value that can be fed into calculations, whereas calculated fields define a dynamic formula that is evaluated row-by-row or as an aggregate against the data.
Question 2: A consultant needs to assign each customer to a cohort based on the month of their very first purchase, regardless of what filters are applied to the view. Which approach is most appropriate?
- DATETRUNC('month', [Order Date])
- DATEDIFF('month', [Order Date], TODAY())
- WINDOW_MIN(MIN([Order Date]))
- {FIXED [Customer ID] : MIN([Order Date])} (Correct answer)
Correct answer: {FIXED [Customer ID] : MIN([Order Date])}
A FIXED LOD expression using MIN([Order Date]) anchored to [Customer ID] computes the first purchase date per customer independent of view filters, enabling accurate cohort assignment.
Question 3: What does the WINDOW_AVG() table calculation function compute in Tableau?
- The average value across the rows defined by the current addressing and windowing configuration (Correct answer)
- The overall column average directly from the database
- A moving average based on a calendar-defined date range
- The aggregate average for each dimension partition independently
Correct answer: The average value across the rows defined by the current addressing and windowing configuration
WINDOW_AVG() computes the average of an expression across the range of rows specified by the table calculation's addressing (start and end offsets within the current partition).
Question 4: In a Tableau table calculation configured with 'Compute Using: Specific Dimensions,' what role does the partitioning configuration play?
- It defines the group of cells within which the calculation resets and restarts (Correct answer)
- It determines the traversal order of rows for the calculation
- It specifies which dimensions are included in the aggregate before the calculation
- It sets the filter applied to data before the table calculation executes
Correct answer: It defines the group of cells within which the calculation resets and restarts
Partitioning defines the boundaries of each independent group; when the table calculation moves from one partition to another, it restarts from the beginning.
Question 5: What is the effect of promoting a dimension filter to a context filter in relation to FIXED LOD expressions?
- The context filter converts FIXED LOD expressions into INCLUDE LOD behavior
- The FIXED LOD expression is now evaluated after the context filter, causing it to respect the filter (Correct answer)
- The context filter removes the need for LOD expressions in that view
- Context filters have no effect on FIXED LOD expressions
Correct answer: The FIXED LOD expression is now evaluated after the context filter, causing it to respect the filter
Context filters are applied before FIXED LOD expressions in Tableau's order of operations, so promoting a dimension filter to context causes FIXED LOD calculations to be scoped to the filtered data.
Question 6: What is the output of the Tableau ZN() function when applied to a field that contains a NULL value?
- It converts the NULL to an empty string
- It replaces the NULL with zero (0) (Correct answer)
- It normalizes the value between 0 and 1
- It excludes the NULL from subsequent aggregations
Correct answer: It replaces the NULL with zero (0)
ZN() (Zero for Null) replaces NULL values with 0, preventing NULLs from propagating through calculations where a zero would be semantically correct.
Question 7: Which Tableau expression correctly calculates the year-over-year sales growth percentage using a table calculation?
- (SUM([Sales]) - LOOKUP(SUM([Sales]), -1)) / ABS(LOOKUP(SUM([Sales]), -1)) (Correct answer)
- (SUM([Sales]) - SUM([Sales])) / SUM([Sales]) * 100
- DATEDIFF('year', [Order Date], TODAY()) * SUM([Sales])
- {FIXED YEAR([Order Date]) : SUM([Sales])} / {FIXED : SUM([Sales])}
Correct answer: (SUM([Sales]) - LOOKUP(SUM([Sales]), -1)) / ABS(LOOKUP(SUM([Sales]), -1))
LOOKUP(SUM([Sales]), -1) retrieves the previous period's sales value, and dividing the difference by that prior value yields the year-over-year growth rate.
What is the primary functional difference between a calculated field and a parameter in Tableau?