Tableau Lesson 36 – Table Calculations | Dataplexa
Section IV — Lesson 36

Table Calculations

Table calculations run after Tableau has already aggregated and laid out the marks in the view — they compute values across the existing marks rather than against the raw data. Running totals, percent of total, rank, and moving averages are all table calculations.

Table Calculations vs Regular Calculated Fields

Regular Calculated Field
Runs against the raw data before aggregation. Every row in the database participates. Adding or removing Dimensions changes the groups, not the formula logic. Lives in the Data pane permanently.
Table Calculation
Runs against the marks already visible in the view. Only the aggregated values participate. Changing which Dimensions are in the view changes the calculation result. Indicated by a delta symbol (△) on the pill.

Adding a Quick Table Calculation

The fastest way to apply a table calculation is the Quick Table Calculation menu. Right-click any Measure pill in the view — on Rows, Columns, or the Marks card — and select Quick Table Calculation. The sub-menu lists eight options. Tableau applies the calculation instantly and marks the pill with a delta symbol to indicate a table calculation is active.

Quick Table Calculation Computes Common Use
Running Total Cumulative sum of marks from first to current Year-to-date revenue, cumulative orders
Difference From Absolute change from a previous mark Month-over-month change in Sales
Percent Difference From Percentage change from a previous mark Year-over-year growth rate
Percent of Total Each mark as a share of all marks Category contribution to total Sales
Rank Position of each mark ordered by value Sales ranking of Sub-Categories
Percentile Percentile position of each mark Customer spend percentile
Moving Average Average of the current mark and N preceding marks Smoothing noisy monthly Sales trend lines
YTD Total Running total reset at each year boundary Year-to-date cumulative revenue by month

Compute Using — Controlling the Direction

Every table calculation has a Compute Using setting that controls which Dimension the calculation runs across. Right-click the pill with the delta symbol → Edit Table Calculation → set Compute Using. Getting this setting wrong is the most common table calculation mistake — the calculation runs in the wrong direction and produces numbers that look correct but are meaningless.

Table (Across)
Runs left to right across the columns. A running total on a time series with months in Columns will accumulate correctly across January through December.
Table (Down)
Runs top to bottom down the rows. A Percent of Total on a bar chart with Sub-Category on Rows will compute share relative to all Sub-Categories in the view.
Pane (Down)
Restarts the calculation within each panel. A running total in a table with Region panels resets to zero at the start of each Region — giving a regional running total rather than a grand running total.
Specific Dimensions
The most precise option — check exactly which Dimensions the calculation should traverse. Recommended for any view with more than two Dimensions to avoid ambiguous direction.

Running Total — Step by Step

1
Build a line chart with Order Date (Month) on Columns and SUM(Sales) on Rows. The line shows monthly Sales — peaks and troughs month by month.
2
Right-click the SUM(Sales) pill on Rows → Quick Table Calculation → Running Total. The line now rises steadily — it shows cumulative Sales from the first month to the current month. A delta symbol appears on the pill.
3
Right-click the pill again → Edit Table Calculation. Confirm Compute Using is set to Table (Across) — this ensures the running total accumulates left to right across the months, not down through any row Dimensions.

Running Total vs Monthly Sales — Labelled Mockup

Running Total of Sales (△) — Table (Across) · Jan–Jun 2023
$0 $100K $200K $300K $38K $81K $114K $162K $202K $248K Jan Feb Mar Apr May Jun Monthly Sales Running Total △

Percent of Total — Step by Step

1
Build a bar chart with Sub-Category on Rows and SUM(Sales) on Columns. Each bar shows the absolute Sales total for that Sub-Category.
2
Right-click SUM(Sales) on Columns → Quick Table Calculation → Percent of Total. The bars now show each Sub-Category's share of total Sales. The axis changes from dollar values to percentages.
3
Edit Table Calculation → Compute Using → Table (Down). This ensures the percentages are computed relative to all Sub-Categories in the view, so they correctly sum to 100%. Adding Region to the Color channel then shows each Sub-Category's share split by Region — still summing to 100% across the whole view.

Writing Table Calculations as Formulas

Quick Table Calculations cover the most common cases. For custom logic, Tableau's table calculation functions can be written directly in the calculation editor. The most useful ones are RUNNING_SUM(), WINDOW_AVG(), RANK(), and INDEX().

RUNNING_SUM — cumulative total of Sales across the view

RUNNING_SUM(SUM([Sales]))

WINDOW_AVG — average across a sliding window of marks

WINDOW_AVG(SUM([Sales]), -2, 0)

RANK — ranking marks by their aggregated value

RANK(SUM([Sales]), 'desc')
📌 Teacher's Note

The Compute Using setting is the part of table calculations that trips up every analyst at least once. The golden rule is: the Compute Using Dimension is the one the calculation travels across — and every other Dimension in the view is the one it restarts for. A running total with Compute Using set to Order Date (month) will accumulate across months — and if Region is also in the view, it will produce a separate running total per Region automatically, restarting at January for each Region. This is almost always the correct behaviour. If your running total is producing strange jumps or resets, the Compute Using direction is almost certainly set to the wrong Dimension. Right-click the delta pill → Edit Table Calculation → switch to Specific Dimensions and manually check only the Dimension you want the calculation to traverse. The delta symbol on a pill is your first diagnostic — if you see a pill without a delta that you expected to behave like a table calculation, the Quick Table Calculation was not applied. If you see a delta and the numbers look wrong, the Compute Using direction needs adjustment.

Practice Questions

1. A line chart shows monthly SUM(Sales). How do you convert it to a running total using the fastest method available?

2. Write the table calculation formula that computes a 3-month moving average of Sales — averaging the current month and the two preceding months.

3. A running total is producing unexpected resets mid-chart. Where do you go to fix the direction the calculation is running across?

Quiz

1. After applying a Quick Table Calculation, what visual indicator on the pill confirms a table calculation is active on that Measure?


2. A Percent of Total table calculation shows each Sub-Category as a share of the whole. When Region is removed from the view, the percentages change. Why does removing a Dimension affect the table calculation result?


3. A view shows Sub-Categories with their SUM(Sales). Write the table calculation formula that ranks each Sub-Category from highest to lowest Sales, with rank 1 assigned to the highest value.


Next up — Lesson 37: Conditional calculations — using IF, IIF, CASE, and logical operators to build segmentation, flags, and business rules directly inside calculated fields.