Thursday, January 13, 2022

Computing Cumulative Grand Total in Tableau

Here is a use case at work where the grand total of a table needs to be accumulated horizontally to the right.

In the table, daily sales are shown by categories. The expected result is as follows:

We will use customized grand total technique to calculate it. The formula is as follows:

Usually we use Min(Category)=Max(Category) as the conditional. However because of null values in Sales and table calculations for cumulative sums, that conditional doesn't work in this case. 

Then we need to use table calculations for it: Window_Min(Min(Category))=Window_Max(Max(Category))

For the cumulative grand total, we use the table calculation: Running_Sum(Sum(Sales))

No comments:

Post a Comment