A quickie on nested table calculations

When speaking about table calculations a repeated request is to show ranking over time based on for example cumulative sales.

Usually, the question will be why what the asker is doing does not work as intended. What can be seen is usually this


The common complaint is that this does not yield what the asker wants to see, no matter how the calculation is set to be computed.

The reason lies in how Tableau considers the table calculations. In the above case, this is considered only one table calculation and therefore, we can only set one calculation direction.

However, what we need is the ability to set two directions. One for the inner part, i.e. the running_sum of sales and one for the outer part, the rank.

In order to achieve that, simply create the calculation in two steps:


Now we can wrap this calculation into another calculation

//Rank by cumulative sales

Now we have a true nested table calculation and are able to set both calculation directions.

Here is the result based on sample – superstore data. See how the ranking moves depending on what the cumulative sales value is.

And that’s it for today.

As always I hope this was useful and I appreciate your feedback.

Until next time


One thought on “A quickie on nested table calculations

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s