Tutorial

Tableau Table Calculations: Running Total, Difference and Moving Average

Use Tableau Quick Table Calculations: Running Total, Difference and 14-day Moving Average with continuous dates.

Anuj SainiAug 23, 20269 min read

Raw daily sales look jagged; monthly totals hide momentum. Table Calculations sit between — they calculate across the table's results to answer "how much cumulatively?", "how much did we grow last month?" and "what is the underlying trend?" Built from script 10, this guide covers the three Quick Table Calculations analysts use most.

Prereqs: Tableau Data Types and Roles for continuous dates, and Tableau Connecting Data Sources for grain. For grain control beyond the view see Tableau Level of Detail Expressions.


What are Quick Table Calculations?

Calculations on table, not rows Tableau Help: Table Calculations. Normal aggregated fields like SUM([Sales]) compute per partition then plot. Table Calculations compute after that aggregation, across marks.

Access via right-click a measure on Rows/Columns > Quick Table Calculation Tableau Help: Quick. No manual formula needed — Tableau writes the table calc for you and adds a delta icon to the pill.

How do you add a Running Total?

Cumulative sum across time Tableau Help: Quick. Script at 1:26 uses 2015-2018 sales:

  1. Drag Order Date (continuous, green) to Columns — ensures chronological axis Tableau Help: Dates.
  2. Drag SUM(Sales) to Rows.
  3. Right-click SUM(Sales) > Quick Table Calculation > Running Total.

The line now climbs cumulatively, showing total revenue to date rather than per-month blips. Edit the calculation to set Compute Using to Table (across) and Restart every None for full history, or Restart every Year for annual cohorts.

tableau
// Equivalent manual form
RUNNING_SUM(SUM([Sales]))

Duplicate the measure with Ctrl-drag to show raw and running total side-by-side for comparison.

How do you compare periods with Difference?

Current minus previous Tableau Help: Quick. At 3:55 the script detects month-to-month swings:

  1. Right-click SUM(Sales) > Quick Table Calculation > Difference.
  2. Edit Table Calculation > Compute Using: Month, Relative to Previous.

Positive bars are growth, negative are drops. Use with Color on Table Calculation to paint gains green and losses red.

tableau
// Conceptual
// Difference = SUM([Sales]) - LOOKUP(SUM([Sales]), -1)

Filter to Keep Only a time window (script at 4:27) to focus on a quarter without rebuilding.

How do you smooth volatility with Moving Average?

Average of current and preceding marks Tableau Help: Table Calculations. At 6:01 the script uses a 14-day window to de-noise daily sales:

  1. Right-click SUM(Sales) > Quick Table Calculation > Moving Average.
  2. Right-click > Edit Table Calculation > Average previous 13 + current = 14-day smoothing.
  3. Optionally exclude current mark if you need a trailing average.

Formula behind it:

tableau
// 14-day moving average
WINDOW_AVG(SUM([Sales]), -13, 0)

Jagged daily spikes flatten, revealing trend. Increase window to 28 for monthly smoothing; shrink to 7 for weekly responsiveness.

Feature / Criteria

Handling dates and measure layout

Two layout tricks from the script:

  • Continuous date: Convert discrete YEAR to continuous Order Date (green) before any table calc; otherwise Tableau partitions time and total restarts incorrectly.
  • Duplicate measures: Hold Ctrl and drag SUM(Sales) onto the same shelf to create two instances — one raw, one table-calc — for overlay or dual-axis comparison. Format each independently via Marks Card shelves.

Gotcha: Discrete Date Breaks Running Total

Your Running Total restarts each year unexpectedly. The culprit is a discrete YEAR header (blue) that partitions the table. Switch Order Date to continuous green, and the total runs 2015–2018 continuously. At ₹5–10 LPA, portfolio reviewers flag this axis error quickly.

Next, move from table-scoped calcs to grain-controlled logic in Tableau Level of Detail Expressions, then make them interactive via Tableau Parameters Dynamic Filters Top-N.

Practice Time-Based Analysis

Build running totals and moving averages on Superstore, then explain the trend in your Data Analyst track case study.

Start Practicing Free

Frequently Asked Questions

What is a Tableau Table Calculation?

A Table Calculation performs math on the aggregated values already in your view (like Running Total), rather than on underlying rows. It computes across the table's marks based on addressing and partitioning.

How do you add a Running Total in Tableau?

Right-click the measure on Rows/Columns > Quick Table Calculation > Running Total, or right-click > Add Table Calculation and choose Running Total. It cumulatively adds values across the direction you set.

What does Difference table calculation do?

Difference shows period-over-period variance: current mark minus previous mark. It is ideal for highlighting month-to-month growth or drops.

How do you smooth noisy daily data in Tableau?

Apply a Moving Average Quick Table Calculation, then Edit Table Calculation to set the window, such as 14 days. It averages the current mark and preceding marks to reveal the trend.

Why must dates be continuous for table calculations?

Continuous dates create a single time axis, so Running Total and Moving Average compute sequentially. Discrete dates split time into headers and break the chronological flow.

Anuj Saini

Written by

Anuj SainiFounder & Lead Instructor

Founder at Topfolio with 6+ years in data & analytics across JPMC, Ultrahuman, and high-growth startups. Sat on hiring panels, reviewed 500+ resumes, and writes practical SQL & data guides.