Tableau Funtion: RUNNING_COUNT( )

Tableau Function: RUNNING_COUNT( )

Category: Table Calculation Functions

Purpose

The RUNNING_COUNT() function in Tableau is a table calculation that computes a cumulative (running) count of values across rows in a partition. For each row, it returns the total number of non-null values encountered from the first row up to the current row, based on the defined sort order.

In simple terms, RUNNING_COUNT() answers:
“How many values have occurred so far?”

Type of Calculations

  • Table calculations

  • Cumulative (running) calculations

  • Count-based analytics

  • Order-dependent calculations

RUNNING_COUNT() is evaluated after aggregation and depends on the structure, partitioning, and sorting of the view.

Practical Use Cases

  • Tracking cumulative event counts over time

  • Monitoring record growth or transaction volume

  • Creating running totals of occurrences

  • Building milestone or progress indicators

  • Supporting rate-based metrics when combined with other functions


RUNNING_COUNT(expression)

ParameterTypeDescription
expressionAggregate / table calculationThe field or aggregated expression to count cumulatively. Only non-null values are counted.

How It Works?

Mathematical / Logical Principle

For each row n, RUNNING_COUNT() calculates:

RUNNING_COUNT = COUNT of non-null values from row 1 to row n

It is functionally equivalent to:

RUNNING_SUM( IIF( NOT ISNULL(expression), 1, 0 ) )

But implemented more efficiently and cleanly.

Example Formula

RUNNING_COUNT(SUM([Orders]))

Computes the running count of Orders

What Does It Return?

  • Data Type: Integer

  • Meaning:

    • Returns the cumulative count of non-null values from the first row to the current row

    • Increments as new non-null values appear

Example Output

RowValueRUNNING_COUNT()
1A1
2B2
3NULL2
4C3

When Should We Use It?

Use RUNNING_COUNT() when you need to:

  • Track cumulative counts over time

  • Measure progress or growth

  • Count occurrences sequentially

  • Support running-rate calculations

  • Build analytical dashboards showing accumulation

Basic Usage

Running count of records


RUNNING_COUNT(SUM([Sales]))

Counts non-null Sales values cumulatively

Column Usage

Running count by date


RUNNING_COUNT([Order ID])

Tracks number of orders over time

Calculate average per event


RUNNING_SUM(SUM([Sales])) / RUNNING_COUNT(SUM([Sales]))

Produces a cumulative average

Advanced Usage

Conditional running count


RUNNING_COUNT(
IF SUM([Profit]) > 0 THEN 1 END
)

Counts only rows meeting a condition

Running count within partitions


RUNNING_COUNT([Customer ID])

(with Compute Using set per Region)

Tracks cumulative customers per region

Tips and Tricks

  • Only non-null values are counted

  • Always define sorting for predictable results

  • Combine with RUNNING_SUM() for rates and averages

  • Sensitive to Compute Using and partitioning

  • Not usable in row-level or LOD calculations

Related Functions

Functions commonly used alongside or as alternatives to RUNNING_COUNT():

  • RUNNING_SUM()

  • RUNNING_AVG()

  • COUNT()

  • WINDOW_COUNT()

  • INDEX()

  • LOOKUP()

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.

1. What does RUNNING_COUNT() do in Tableau?

It calculates the cumulative count of non-null values from the first row to the current row.

2. Does RUNNING_COUNT() count NULL values?

No, only non-null values are counted.

3. Is RUNNING_COUNT() affected by sorting?

Yes, sorting determines the order in which values are counted.

4. Is RUNNING_COUNT() a table calculation?

Yes, it is evaluated after aggregation and depends on the view layout.

5. How is RUNNING_COUNT() different from COUNT()?

COUNT() returns a total count, while RUNNING_COUNT() returns a cumulative count across rows.