Tableau Funtion: RUNNING_AVG( )
Tableau Function: RUNNING_AVG( )
Category: Table Calculation Functions
Purpose
The RUNNING_AVG() function in Tableau is a table calculation that computes a cumulative (running) average of a measure across rows in a partition. For each row, it calculates the average of all values from the first row up to the current row, based on the defined sort order.
In simple terms, RUNNING_AVG() answers:
“What is the average of all values seen so far?”
Type of Calculations
Table calculations
Cumulative (running) calculations
Trend-smoothing calculations
Order-dependent analytics
RUNNING_AVG() is evaluated after aggregation and depends entirely on the structure and sorting of the view.
Practical Use Cases
Smoothing volatile trends over time
Analyzing cumulative performance
Tracking long-term averages (e.g., average sales to date)
Comparing current values against historical averages
Creating trend lines and benchmark indicators
RUNNING_AVG(expression)
| Parameter | Type | Description |
|---|---|---|
| expression | Aggregate / table calculation | The numeric value to average cumulatively. Must be aggregated in the view. |
How It Works?
Mathematical / Logical Principle
For each row n, RUNNING_AVG() calculates:
RUNNING_AVG = (Sum of values from row 1 to row n) / n
It is equivalent to:
RUNNING_SUM(expression) / RUNNING_COUNT(expression)
But optimized and easier to use.
Example Formula
RUNNING_AVG(SUM([Sales]))
✔️ Calculates the running average of Sales
What Does It Return?
Data Type: Numeric (decimal)
Meaning:
Returns the average of the expression from the first row to the current row
Updates dynamically as new rows are included
Example Output
| Row | Value | RUNNING_AVG() |
|---|---|---|
| 1 | 100 | 100 |
| 2 | 200 | 150 |
| 3 | 300 | 200 |
When Should We Use It?
Use RUNNING_AVG() when you need to:
Smooth trends across time or ordered data
Track cumulative performance averages
Reduce noise in fluctuating datasets
Compare current performance against historical norms
Build analytical dashboards with trend context
Basic Usage
Running average of a measure
RUNNING_AVG(SUM([Sales]))
Computes cumulative average of Sales
Column Usage
Running average over time
RUNNING_AVG(AVG([Profit]))
Smooths profit trends across dates
Compare value to running average
SUM([Sales]) - RUNNING_AVG(SUM([Sales]))
Shows deviation from cumulative average
Advanced Usage
Conditional flag using running average
IF SUM([Sales]) > RUNNING_AVG(SUM([Sales]))
THEN "Above Average"
ELSE "Below Average"
END
Highlights periods outperforming historical average
Running average within partitions
RUNNING_AVG(SUM([Sales]))
(with Compute Using set per Region)
Calculates independent running averages per region
Tips and Tricks
Always define sorting (especially for time-series)
Verify Compute Using and partition direction
Use for smoothing—not precise point-in-time averages
Sensitive to sort order
Not suitable for row-level calculations or LODs
Related Functions
Functions commonly used alongside or as alternatives to RUNNING_AVG():
RUNNING_SUM()RUNNING_COUNT()WINDOW_AVG()LOOKUP()PREVIOUS_VALUE()INDEX()
We’ve got plenty of resources to help you master Tableau functions. For more details, check out the official Tableau documentation. Or, if you’re ready for more practice, let’s dive into related functions and build your Tableau skills further!
If you’re ready to harness the full power of Tableau and elevate your data analytics capabilities, our expert Tableau consulting services are here to guide you. Whether you need support with building advanced calculated fields, creating dynamic visual dashboards, or optimizing your data sources for peak performance, our team of experienced Tableau consultants delivers customized solutions designed for your business needs. Visit our Tableau Consulting page to discover how we can help your organization turn data into impactful, insight-driven decisions.
It calculates the cumulative average of a measure from the first row to the current row.
Yes, sorting determines the order in which values are accumulated.
Yes, it is evaluated after aggregation and depends on the view layout.
RUNNING_AVG() accumulates progressively, while WINDOW_AVG() averages over a fixed window.
Yes, it is commonly used to smooth and analyze trends over time.