Popular Searches
Popular Course Categories
Popular Courses

Running Total Calculations

Table Calculations and Aggregations

Running Total Calculations in Tableau – Complete Detailed Notes

Course: Tableau Data Visualization and Analytics

Topic: Running Total, Cumulative Sum, Running Average, and Running Minimum/Maximum

Learning Objectives: Understand running total calculations, use Tableau's Quick Table Calculation feature, create calculated fields with RUNNING_SUM(), configure calculation direction, restart calculations by group, and build cumulative analysis dashboards.


1. Introduction to Running Total Calculations

A running total is a cumulative calculation that combines the current value with the values that came before it in a specified sequence. In Tableau, a running total is a table calculation that transforms the values displayed in a visualization.

For example, if a business earns sales of ₹10,000 in January, ₹15,000 in February, and ₹20,000 in March, its cumulative sales are ₹10,000 in January, ₹25,000 in February, and ₹45,000 in March.

Running totals are useful for tracking progress over time, monitoring cumulative revenue, measuring year-to-date sales, and analyzing growth toward business targets.

Key Characteristics

  • Calculates values cumulatively in a defined order.
  • Depends on the dimensions and marks present in the visualization.
  • Can be configured to calculate across rows, columns, dates, or other dimensions.
  • Can restart for each group, such as each region or year.
  • Can use different aggregations, including Sum, Average, Minimum, and Maximum.

2. Understanding the Running Total Formula

A running total adds the current value to the accumulated value from preceding rows in the calculation sequence.

Mathematical Formula

Running Total at position n = Value 1 + Value 2 + ... + Value n

Another way to express the calculation is:

RunningTotal(n) = RunningTotal(n - 1) + CurrentValue(n)

The first running total is equal to the first value because no previous values exist.

Example

Month Monthly Sales Running Total Calculation
January ₹10,000 ₹10,000 10,000
February ₹15,000 ₹25,000 10,000 + 15,000
March ₹20,000 ₹45,000 25,000 + 20,000
April ₹12,000 ₹57,000 45,000 + 12,000
May ₹18,000 ₹75,000 57,000 + 18,000

The running total increases as new monthly sales are added. If sales are positive, the cumulative amount increases; if a period contains negative sales or adjustments, the running total may decrease.

3. Running Total vs. Regular Total

A regular total summarizes values across a group. A running total displays the cumulative amount at each position in a sequence.

Month Monthly Sales Regular Monthly Value Running Total
January 100 100 100
February 200 200 300
March 150 150 450
April 250 250 700

Regular total: The total across all four months is 700.

Running total: The values show cumulative progress: 100, 300, 450, and 700.

4. Running Total in Tableau

Tableau supports running total calculations through Quick Table Calculations and calculated fields. The Quick Table Calculation approach is convenient for beginners, while a calculated field provides a reusable formula.

Method 1: Using Quick Table Calculation

  1. Open Tableau Desktop, Tableau Cloud authoring, or another supported Tableau authoring environment.
  2. Connect to a dataset that contains a date or sequence field and a measure such as Sales.
  3. Drag Order Date to Columns or Rows.
  4. Choose the date level required, such as Month.
  5. Drag Sales to Rows, Columns, or Text on the Marks card.
  6. Right-click the SUM(Sales) pill in the view or on the relevant Marks card.
  7. Select Quick Table Calculation and then Running Total.
  8. Review the cumulative values and confirm that the calculation follows the intended order.

Result: Tableau converts the displayed monthly sales values into cumulative values based on the configured table calculation direction.

Method 2: Using a Calculated Field

  1. In the Data pane, right-click and select Create Calculated Field.
  2. Name the field Running Total Sales.
  3. Enter the formula below.
  4. Validate the calculation and click OK.
  5. Drag Running Total Sales into the visualization.
  6. Configure the table calculation direction to match the sequence in the view.
RUNNING_SUM(SUM([Sales]))

Explanation:

  • SUM([Sales]) aggregates sales at the level of detail of the view.
  • RUNNING_SUM() accumulates those aggregated values from the first mark to the current mark in the partition.

Table calculations depend on the visualization's structure. If the dates are not sorted correctly or the calculation direction is wrong, the result may not represent the expected cumulative sequence.

5. Understanding RUNNING_SUM()

RUNNING_SUM() is a Tableau table calculation function that returns the cumulative sum of an expression from the first row in a partition to the current row.

Syntax

RUNNING_SUM(expression)

Example 1: Running Total of Sales

RUNNING_SUM(SUM([Sales]))

Use this calculation to show cumulative sales over months, quarters, years, or another ordered dimension.

Example 2: Running Total of Profit

RUNNING_SUM(SUM([Profit]))

This calculation shows cumulative profit across the order in which the marks are evaluated.

Example 3: Running Total of Quantity

RUNNING_SUM(SUM([Quantity]))

This calculation can track cumulative units sold over time.

Example 4: Running Total of Orders

RUNNING_SUM(COUNTD([Order ID]))

This can accumulate the distinct order count for each mark in the view. Ensure that the view's date granularity and calculation direction are appropriate. If an order can occur across multiple date groups, group-level distinct counts may not equal the overall distinct order count.

6. Understanding the Compute Using Setting

The Compute Using setting controls the direction in which Tableau evaluates a table calculation. The correct choice depends on how dimensions are arranged in the visualization.

Option Meaning Example Use
Table (Across) Calculates across the columns in the table. Cumulative values across columns representing months.
Table (Down) Calculates down the rows in the table. Cumulative values down rows representing months.
Pane (Across) Calculates across columns within each pane. Separate cumulative calculations within each pane.
Pane (Down) Calculates down rows within each pane. Cumulative values within each pane of a table.
Cell Calculates within the individual cell context. Useful only for views and calculations where cell-level computation is applicable.
Specific Dimensions Lets you choose the dimensions used to address and partition the calculation. Running total by month, restarting by year or region.

Exact available options depend on the dimensions and layout of the view. For a simple monthly chart with Month on Rows, Table (Down) is often appropriate. If Month is on Columns, Table (Across) may be appropriate.

How to Change Compute Using

  1. Right-click the running total measure in the view.
  2. Select Edit Table Calculation.
  3. Open the Compute Using menu.
  4. Select the appropriate table direction or Specific Dimensions.
  5. Check the highlighted marks to verify the direction.
  6. Confirm that the cumulative values restart or continue as intended.

7. Running Total by Month

A common use case is calculating cumulative sales from the beginning of the year through each month.

Sample Dataset

Month Sales Running Total Sales
January ₹5,000 ₹5,000
February ₹7,000 ₹12,000
March ₹4,000 ₹16,000
April ₹9,000 ₹25,000
May ₹6,000 ₹31,000
June ₹8,000 ₹39,000

Steps

  1. Place Order Date on Columns and select Month.
  2. Place Sales on Rows.
  3. Ensure the months are sorted chronologically rather than alphabetically.
  4. Apply Quick Table Calculation → Running Total.
  5. Set Compute Using to the direction that follows the month sequence.
  6. Rename the axis or calculation to Running Total Sales.

Business Insight: The chart shows how much sales revenue has accumulated by the end of each month.

8. Running Total by Year

When data contains multiple years, decide whether the running total should continue across all years or restart at the beginning of each year.

Option A: Continuous Running Total Across Years

A continuous running total adds each new period to the cumulative amount from all earlier periods, including previous years.

Option B: Running Total That Restarts Every Year

A yearly running total begins again in January for each year. This is useful for year-to-date comparisons.

Year Month Sales Running Total Within Year
2025 January 100 100
2025 February 150 250
2025 March 200 450
2026 January 120 120
2026 February 180 300
2026 March 220 520

How to Restart by Year

  1. Place Year and Month in the view, with the date fields arranged in the desired hierarchy.
  2. Apply the running total calculation.
  3. Open Edit Table Calculation.
  4. Select Specific Dimensions if the default settings do not produce the intended result.
  5. Set the date dimension used for the cumulative sequence as the addressing dimension.
  6. Configure Year as a partitioning dimension, so the calculation is evaluated separately for each year.
  7. Verify that the running total resets at the beginning of each new year.

The exact configuration depends on the order and placement of dimensions in the view. Always validate the result against a small sample table.

9. Running Total by Region or Category

Running totals can be calculated separately for groups such as regions, product categories, departments, or sales representatives.

Example: Running Total by Region

Region Month Sales Running Total Within Region
East January 100 100
East February 150 250
East March 200 450
West January 80 80
West February 120 200
West March 180 380

In this example, the running total restarts for each region. The East region's cumulative value does not carry over into the West region.

Common Applications

  • Monthly cumulative sales by region.
  • Cumulative profit by product category.
  • Running quantities by department.
  • Year-to-date performance by salesperson.
  • Progress toward separate targets for each business unit.

10. Other Running Aggregations in Tableau

Tableau's Running Total table calculation dialog can use different aggregation methods. These are not all cumulative sums, so choose the method that matches your analytical goal.

Aggregation What It Does Example
Sum Adds the current value to the previous accumulated values. 100, 150, 200 → 100, 250, 450.
Average Calculates the average of the values from the beginning of the partition through the current position. 100, 150, 200 → 100, 125, 150.
Minimum Returns the lowest value encountered from the start through the current position. 100, 80, 120 → 100, 80, 80.
Maximum Returns the highest value encountered from the start through the current position. 100, 150, 120 → 100, 150, 150.

Note: Running Average, Running Minimum, and Running Maximum are cumulative calculations, but they do not add values together in the way a running sum does.

11. Running Total vs. Running Average

A running total measures accumulated quantity or value. A running average measures the average value observed from the start of the sequence to the current position.

Month Sales Running Total Running Average
January 100 100 100
February 200 300 150
March 300 600 200
April 200 800 200

Running total is useful for cumulative progress. Running average is useful for understanding the average value over the periods included so far.

12. Running Total and Sorting

A running total follows the order of the marks used by the table calculation. Sorting is therefore important.

  • Chronological order: Use this for running sales by date.
  • Ascending order: Useful when the calculation should follow low-to-high values or another ascending dimension.
  • Descending order: Useful when the cumulative calculation intentionally follows a high-to-low sequence.

For a month-by-month running total, sort dates chronologically. Sorting months alphabetically can produce an incorrect business interpretation because April may appear before February or January.

13. Running Total with Filters

Table calculations are evaluated using the marks available in the view. Filtering dimensions can change the values included in the running total, so understand whether the filter removes data needed for the calculation.

Example

Suppose monthly sales are January 100, February 200, March 300, and April 400. The running totals are 100, 300, 600, and 1,000.

If February is filtered out before the table calculation is evaluated, the visible sequence may become January 100, March 400, and April 800. The calculation is based on the remaining marks rather than automatically preserving the hidden February value.

Best Practice: When you need a calculation to include periods that should not be visibly displayed, investigate Tableau's filter order of operations and consider whether hiding marks, a different filter type, or a different calculation design is appropriate.

14. Running Total and Grand Totals

A running total shows cumulative values at each mark, while a grand total summarizes the values in a table. They are related but not interchangeable.

  • For a single chronological sequence of additive sales values, the final running sum should equal the sum of the included sales values.
  • When multiple partitions exist, each partition may have its own final running sum.
  • Distinct counts, averages, and other non-additive measures may not behave like a simple sum of displayed results.
  • Grand total behavior can differ from the final displayed mark depending on the calculation and table structure.

15. Practical Project: Cumulative Sales Dashboard

Project Objective: Build a dashboard that tracks monthly sales, cumulative sales, and progress across regions.

Dataset Requirements

  • Order Date
  • Sales
  • Profit
  • Region
  • Category
  • Order ID

Calculated Fields

// Running Total Sales
RUNNING_SUM(SUM([Sales]))

// Running Total Profit
RUNNING_SUM(SUM([Profit]))

// Running Total Quantity
RUNNING_SUM(SUM([Quantity]))

Use the Quantity calculation only when the dataset contains a field named Quantity. If it does not, replace it with an available measure.

Dashboard Development Steps

  1. Connect to the dataset and confirm that Order Date is recognized as a date field.
  2. Create a monthly sales worksheet.
  3. Add the Running Total Sales calculated field.
  4. Set the table calculation to follow the chronological month sequence.
  5. Create a second worksheet for cumulative profit.
  6. Create a regional view where the running total restarts for each region, if required.
  7. Add date, region, and category filters.
  8. Combine the worksheets in a dashboard.
  9. Test the dashboard using different date ranges and regions.
  10. Verify the cumulative values against the underlying monthly totals.

Possible Business Insights

  • Identify when cumulative sales reach a business target.
  • Compare the cumulative performance of different regions.
  • Understand how much profit has accumulated over a period.
  • Identify seasonal patterns in sales growth.
  • Compare year-to-date progress between different years.

16. Troubleshooting Common Running Total Problems

Problem Possible Cause Solution
Running total restarts unexpectedly Partitioning or addressing settings are incorrect. Open Edit Table Calculation and review Specific Dimensions.
Values accumulate across all years The calculation is configured as one continuous sequence. Partition the calculation by year if year-to-date results are required.
Values appear in the wrong order Dates or categories are sorted incorrectly. Apply the intended chronological or business order.
Values change after adding a dimension The view's level of detail has changed. Review addressing, partitioning, and aggregation levels.
Results change after applying a filter The filter removes marks from the table calculation. Review filter behavior and Tableau's order of operations.
Formula shows an error Field names, aggregation, or syntax are incorrect. Check field names and use an expression such as RUNNING_SUM(SUM([Sales])).
Running total decreases Some values may be negative. Check returns, adjustments, losses, and the underlying measure.

17. Best Practices for Running Total Calculations

  • Always verify the sort order before interpreting a running total.
  • Choose the correct level of date detail, such as day, month, quarter, or year.
  • Decide whether the calculation should continue across all periods or restart for each group.
  • Use clear field names such as Running Total Sales or Year-to-Date Profit.
  • Validate the last cumulative value against the expected total for a simple additive sequence.
  • Check how filters affect the marks included in the calculation.
  • Use a simple text table to test the calculation before building a complex dashboard.
  • Do not assume that every measure is additive; distinct counts and averages require special care.

18. Practice Exercises

Exercise 1: Monthly sales are 100, 200, 150, and 250. Calculate the running total.

Exercise 2: Write a Tableau formula for cumulative sales.

Exercise 3: Explain the difference between a running total and a running average.

Exercise 4: A running total should restart every January. What configuration should you review?

Exercise 5: Monthly sales are 100, 200, and 300. If the February mark is removed from the view before the table calculation is evaluated, what running totals can result for the remaining months?

Exercise 6: Create a cumulative sales chart by region and ensure the running total restarts for each region.

Practice Exercise Answers

  1. 100, 300, 450, 700.
  2. RUNNING_SUM(SUM([Sales])).
  3. A running total accumulates values; a running average calculates the average from the first value through the current value.
  4. Review the table calculation's addressing and partitioning settings so the calculation is evaluated separately for each year.
  5. January = 100 and March = 400, assuming March follows the remaining January value in the sequence and the February value is excluded from the calculation.
  6. Use Region as a partitioning dimension and the intended date field as the addressing dimension, then validate each region separately.

19. Tableau Interview Questions and Answers

Q1. What is a running total in Tableau?

Answer: A running total is a table calculation that accumulates values from the beginning of a partition through the current mark.

Q2. Which Tableau function calculates a running sum?

Answer: RUNNING_SUM() calculates the cumulative sum of an expression.

Q3. What is the syntax for a running total of sales?

Answer: RUNNING_SUM(SUM([Sales])).

Q4. What is the difference between a running total and a grand total?

Answer: A running total shows cumulative values at each mark. A grand total summarizes values across a relevant group or table.

Q5. What does Compute Using control?

Answer: It controls the direction and dimensions along which the table calculation is evaluated.

Q6. How do you restart a running total each year?

Answer: Configure the table calculation so the date sequence is addressed within each year partition, then verify that January begins a new cumulative sequence.

Q7. Can running totals be calculated by region?

Answer: Yes. Configure Region as a partitioning dimension when a separate cumulative sequence is required for each region.

Q8. Why might a running total change when a dimension is added?

Answer: Adding a dimension changes the view's level of detail and may change how the table calculation addresses or partitions marks.

Q9. Can a running total decrease?

Answer: Yes. Negative values, such as refunds or adjustments, can reduce a cumulative sum.

Q10. How do you troubleshoot an incorrect running total?

Answer: Check the sort order, Compute Using setting, addressing and partitioning dimensions, filters, and aggregation level.

20. Quick Revision Checklist

  • Understand cumulative calculations and their business uses.
  • Know the formula RUNNING_SUM(SUM([Sales])).
  • Know how to apply Quick Table Calculation → Running Total.
  • Understand Compute Using and Specific Dimensions.
  • Distinguish a continuous running total from a total that restarts by year or region.
  • Understand Running Average, Running Minimum, and Running Maximum.
  • Check sorting and filters before validating results.
  • Practice cumulative charts and dashboards with monthly sales data.

21. Conclusion

Running Total Calculations are essential for cumulative analysis in Tableau. They help analysts understand how values accumulate over time, compare progress across groups, and measure performance against business goals. The most important formula to remember is RUNNING_SUM(SUM([Sales])). Correct sorting, addressing, partitioning, and filter configuration are essential for reliable results.

22. Learn Tableau with JustAcademy

Explore Tableau training to develop skills in data visualization, calculated fields, table calculations, dashboard creation, and business reporting.

23. Official Tableau References

whatsapp