Excluding Null Values from Running Total

Published: 21 Feb 2014
Last Modified Date: 08 Oct 2019


How to create a running total that does not extend as a flat line past the dates that have actually occurred.


Tableau Desktop 


  1. Select Analysis > Create Calculated Field to create a calculated field
  2. In the Calculated Field dialog box that opens, type a name for the field
  3. In the formula field, create a calculated field similar to the following and then click OK:
    IF NOT ISNULL(SUM([<Field>])) 
    THEN RUNNING_SUM(SUM([<Field>]))

    where <Field> is the field that is used in the running total quick table calculation
  4. Create similar calculations for all measures in the view that are being calculated as running totals
  5. Replace the running total quick table calculations in the view with the newly created calculated fields

If the flat line shows at zero, then do the following:
  1. Right-click the calculated field in the view and select Format... If the view contains multiple measures, then right-click Measure Values and select Format...
  2. In the left-hand Format pane, under Special Values, in the Marks dropdown select Hide (Connect Lines)

Additional Information

Note: This solution will work if you have rows/dates in your data set that don't yet have numeric data. For example, a skeleton transaction table with future dates in the year listed, but empty sales data until transactions have occurred. See the attached sample workbook for an example. 

To see these steps in action, watch the video below. 
Note: Video is silent. 

Discuss this article... Feedback Forum
Did this article resolve the issue?