In this article we will show you, How to calculate the Tableau Running Total with example. For this we are going to use the Data Source we created in our previous article so, Please visit Data Labels in Tableau Reports article to understand the Data Source.
Calculating Tableau Running Total
Before we start calculating the running total, let me create a tableau report that we are going to use in this example. First, Drag and Drop the order date (Year) from Dimension Region to Column Shelf. Next, Drag and Drop the Order date (Quarter), and Order date (Month) from Dimension Region to Rows Shelf. Lastly, Drag and Drop the Sales Amount from measures region to text filed present in the Marks shelf. Once you drag them, following Table Report will be generated.
As you can see we don’t have much data (sales) for the year 2010, and 2014. So, we are excluding those two years from the table report by selecting those two columns, and then clicking the exclude button present in the tool tip
Below screenshot will show you the final report that we are going to use for calculating the running total.
In order to calculate the running total in tableau, we have to add the table calculation. To do so, please click on the Down arrow besides the Sales Amount measure (change as per your requirement) will open the context menu. From the list of available options, either you can select the Add Table Calculation option or Quick Table Calculation option. I suggest you use the Add Table Calculation option
Once you click on the Add Table Calculation option, a new window called Table Calculation will be opened as we shown below. As you can see, by default, tableau has selected the Calculation Type as Difference from, and Compute using option as Table (across).
Please change the calculation type from Difference From option to Running Total
Next, change the Computing using option from Table (across) to Table (down)
As you can see, we have successfully generated the tableau report that is calculating the running total.
I think it will be nice to show the Sales Amount values. So that you can compare the Running Total with the Original Sales Amount values. Let us add the Sales Amount to Columns Shelf. As you can see it shows the Original values, and its running total for each individual year.
Tableau Running Total for each Partition
It will nice, if we calculate the Running total for each partition, or each Quarter. In order change the existing calculation we have to edit it. To edit the existing table calculation, please click on the down arrow beside the table calculation will open the context menu. Here you have to select the Edit Table Calculation option as shown below.
Once you click on the Edit Table Calculation option, a new window called Table Calculation will be opened. As you can see, tableau has selected the best possible options such as: Calculation Type as Running Total, Aggregation as SUM, and Compute using option as Specified Dimensions (Quarter of Order date, and Month of Order Date) by default. Here, you have to change the Restarting Every option from None to Quarter of Order date. This wil ensure tableau to restart the running total for every quarter of the year.
Now you can see the running total for each quarter
Add Secondary Calculation
Tableau allows us to add the secondary calculation to the report. It is very helpful to calculate further on top of the existing calculation. To do so, Please check the Add Secondary Calculation option as shown below.
Please leave all the default settings, and change the Secondary Calculation Type option from the Difference From to Percentage Difference From
Following screenshot will show you the Percentage of difference in running total
Thank You for Visiting Our Blog