Creating a Running SUM of Each Color Values Across a Stacked Bar Chart

Published: 22 Jun 2016
Last Modified Date: 18 Jan 2019


How to create a running sum of the values for each color across a stacked bar chart.


Tableau Desktop


Placing INDEX() on Detail on the Marks Card should resolve the issue. 

To reproduce and try the solution, please use the attached workbook Stacked Bar Charts-running sum.twbx and start from Sheet 2. Problem. To view the results, see the Solution Sheet in the same workbook where the field F is the running sum of all previous categories. 
  1. Start with the "2. Problem" worksheet.
  2. Create a new calculated field called "INDEX" and use the following formula:
  3. Drag "INDEX" to Detail on the Marks Card.
  4. Right-click on "INDEX" on the Marks Card and select 'Edit Table Calculation'
  5. Select the 'Compute using:' drop down menu.
  6. Click Specific Dimension and move Product above Category in the partition. 
    • Both Product and Category should be ticked.
  7. In the section At the level, choose: "Product"
  8. Click OK.

Additional Information

The "INDEX" field must be on Detail because it will create domain padding specific to the stacked bar chart. In text tables, it is very clear how domain padding is computed, but because of the way stacked bar charts are laid out, it is impossible to see how the domain padding is actually working. We do know the way "INDEX" is being addressed/partitioned affects the final running total of Value.

Note: the above workaround is not needed when the running sum is computed along a dimension that is a "date" type.

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