Tableau / Intermediate: calculation and interaction scope / Lesson 9
Table calculations, addressing and partitioning
Define the virtual table, direction and restart boundaries behind running totals, differences and percent-of-total calculations.
On this page
Lesson goals
- Distinguish view-local calculations from source-row calculations.
- Explain addressing, partitioning and sort order.
- Predict filtering and layout effects on a running total.
Identify the virtual table
A table calculation transforms values in the visualization’s virtual table, which is determined by its dimensions and marks. It is not automatically a calculation over every source row or every date in the database. A running total over visible monthly sums therefore depends on the marks delivered to it and their ordering. Define those inputs before selecting a quick calculation. Adding a dimension can change the virtual table even when the underlying data source is unchanged. A familiar calculation name does not guarantee that its scope still matches the original question.
Define addressing and restart
Addressing fields describe the direction through marks; partitioning fields define groups where the calculation is performed separately. A monthly running total can address Month and partition by Year and Region. The first expression needs these settings in addition to its text. For January 10, February 30 and March 20 in one partition, the expected sequence is 10,40,60. A different sort or restart changes the meaning. Specific-dimension settings should be reviewed explicitly rather than assumed from the current position of rows and columns, especially after dashboard authors rearrange a sheet.
RUNNING_SUM(SUM([Sales]))
Assume chronological Month addressing in one Year/Region partition. Expected 10,40,60 depends on that view configuration, which is not executed.
Separate hiding from upstream removal
An upstream dimension filter can remove marks before the table calculation, changing its denominator or cumulative history. A table-calculation filter can instead hide results after computation without the same upstream effect. These are distinct behaviors, not interchangeable ways to show only recent months. Define whether a display should retain earlier history when showing March. Do not rely on a hidden mark to enforce data security. Also distinguish missing-domain completion from actual observations: a generated date mark does not prove a zero event count or a valid source record for that date.
Trace a running-window oracle
The second program calculates the full running sequence and compares March’s cumulative 60 with March-only 20 after prior months are removed first. It models operation order only, not Tableau addressing or densification. The difference helps expose a false assertion that every filter is merely visual hiding. Retain the partition key, sort order and included marks in a diagnostic record. For moving averages or differences, also define the window and first-period behavior; there may be no prior value at a partition boundary. A blank first difference should not be silently called a zero change without a policy.
values = [10, 30, 20]
running = []
total = 0
for value in values:
total += value
running.append(total)
print(running)
print(running[-1])
print(sum(values[-1:]))
[10, 40, 60]
60
20
The full sequence is 10,40,60; keeping only the final raw value gives 20. This is not a Tableau table-calculation execution.
Review layout and filter variants
Test one partition, two regions, a year boundary, reversed sort and a last-month display requirement. Record expected restarts and whether earlier marks contribute. A calculation can change after adding Color, Detail or another header, so verify actual addressing and partitioning instead of copying across/down settings blindly. This course runs only the list oracle and touches no worksheet. Engine evaluation, missing-mark generation and quick-calculation configuration remain untested. A rigorous handoff names the virtual table, dimensions, sort, window and filter stage, making a cumulative number explainable independently of the current screen arrangement.
Common errors and fixes
A running total restarts at an unexpected header
- Why it happens
- Partitioning changed with view detail or Compute Using settings.
- How to fix it
- Define addressing and partition fields explicitly.
- Prevent it next time
- Test a second region and year boundary.
Filtering to March changes 60 to 20 unexpectedly
- Why it happens
- Earlier marks were removed before cumulative computation.
- How to fix it
- Choose the intended filter stage and history-retention contract.
- Prevent it next time
- Compare upstream removal with post-calculation display cases.
An absent previous period is labeled zero change
- Why it happens
- Boundary nulls were replaced without business meaning.
- How to fix it
- Define first-period and missing-period behavior separately.
- Prevent it next time
- Keep partition-boundary fixtures in window-calculation review.
Check your understanding
1. Why can March show 60 in a cumulative view and 20 after filtering raw months first?
Show worked solution
The first includes January 10 and February 30 before adding March 20. The second supplies only March to the calculation. Decide whether the reader wants retained history or a recalculated selected-window total, then choose the documented filter stage. Neither number alone proves a calculation defect.
2. What should be rechecked when Region is added to Color?
Show worked solution
Region can change virtual-table detail and must become an intended addressing or partitioning dimension. Verify running sequences and restarts per region, plus sort and denominator scope. The expression text may remain unchanged while the population and traversal change, so a visual style edit can require calculation acceptance again.
Key takeaways
- Table calculations depend on the virtual table, order and partition boundaries.
- Filter stage determines whether history is removed or results are hidden.