Comprehensive and Detailed Explanation From Exact Extract:
A LOOKUP table calculation requires access to rows outside the filtered date range so that the calculation can reference prior data. When a Relative Date Filter removes older data before the table calculation is evaluated, the LOOKUP loses the needed rows, causing the prior year’s data to disappear.
Tableau’s order of operations states:
Relative Date Filters act early (at the dimension filter stage).
Table calculations act very late.
To preserve table calculation context, filters must not remove necessary rows.
Two Tableau-documented approaches address this:
Explanation for B
Setting the Relative Date Filter as a Context Filter allows table calculations to operate on the full dataset needed for LOOKUP. Context filters create a separate temporary table, and subsequent filters like table calculations evaluate after the context is established.
This ensures older rows are still available to the LOOKUP function.
Explanation for C
Creating a field such as:
LOOKUP(MIN([Order Date]), 0)
and filtering on this field instead of Order Date converts the filter into a table calculation filter, which occurs after the LOOKUP computation. Tableau documentation explains that table calculation filters preserve the full dataset required for the LOOKUP window.
This ensures that the LOOKUP still has access to last year's values even when filtering for the current 12 months.
Why A is incorrect
Replacing LOOKUP with an LOD changes the logic entirely.
LOD expressions cannot replicate moving-window or lag-type behavior.
Why D is incorrect
DATEDIFF logic can replicate a rolling window, but hiding False values is essentially a manual filter and does not preserve the integrity of the LOOKUP’s required partitioning. It also contradicts Tableau’s recommended approach for maintaining table calculation context.
Tableau Order of Operations explaining why table calculation filters preserve data for LOOKUP.
Tableau documentation on context filters and how they allow more data to remain available for downstream table calculations.
Tableau guidance on how Relative Date Filters interact with table calculations.
Best practices for preserving table calculation window rows when filtering.
Submit