Tableau Deep Dive: Table Calculations – Custom Sorts, Part Two

Data

Tableau Deep Dive: Table Calculations – Custom Sorts, Part Two

Tableau Deep Dives are a loose collection of mini-series designed to give you an in-depth look into various features of Tableau Software.

In part one of this two-parter, I went into a lot of depth on how to use custom sorts within table calculations. I highly recommend reading that article first before continuing with the second part. In this post, we’re going to apply those ideas to illustrate how useful they can be with a little imagination.

Ascending Running Sum

Let’s begin with some basic concepts and then apply some extras as we go along to make it into something fun. I’ll start with an ascending running sum. Rather than Pane (down), we are effectively creating a table calculation that is running Pane (up). Why would we need to do this? In our use case, we’re going to show sales as a month-to-date total with the most current day at the top of the table. Here’s the basic table showing Month and Day along with SUM of Sales below:

Tableau table calculations custom sorts

Now, let’s add a second SUM of Sales with a Running Total (SUM) table calculation onto this view, restarting on each month:

Tableau Table calculations custom sorts

You should get this view:

Tableau Table calculations custom sorts

I’m going to re-sort my Month and Day date parts on Rows in ascending order to get the most current date at the top of each month pane. My table calculation does not change, still effectively going Pane (down):

Tableau Table calculations custom sorts

Let’s do a custom sort on our table calculation to change the order that the Running Sum computes across our data. I want it to sort in reverse order:

Tableau Table calculations custom sorts

Remember, the minimum is to satisfy the aggregation requirement for the sorting dimension. Minimum or maximum would have worked fine in this instance. This will give our table the current daily sales next to the MTD total, like so:

Tableau Table calculations custom sorts

I’m not interested in seeing the daily detail on every month. It makes the most sense to see the daily detail on the current month, but I want that month aggregated into a single monthly value. It’s best to start with our parameter to determine our level of detail by month:

Tableau Table calculations custom sorts

Let’s use our parameter in a calculated field to control the level of detail for that month:

Tableau Table calculations custom sorts

As well as a calculated field for Daily Sales:

Tableau Table calculations custom sorts

The Day Detail field will replace the day date part on Rows. And to put a little polish on our view, let’s drag the Sales table calculation onto our Data pane and give it a friendly name for our users. This is our final view:

 

 

What’s Next?

Be sure to check back on the InterWorks blog for more content on Tableau and table calculations. Leave any questions or thoughts in the comments section below. Cheers! 

Want More Tableau Deep Dives

  1. Tableau Deep Dive: LOD – Introduction to Detail
  2. Tableau Deep Dive: LOD – The Include Calculation
  3. Tableau Deep Dive: LOD – The Exclude Calculation
  4. Tableau Deep Dive: LOD – The Fixed Calculation
  5. Tableau Deep Dive: LOD – LOD Calculations vs. Table Calculations
  6. Tableau Deep Dive: Parameters – Parameter Overview
  7. Tableau Deep Dive: Parameters – Parameter Properties
  8. Tableau Deep Dive: Parameters – Filtering – Top N
  9. Tableau Deep Dive: Parameters – Calculated Fields
  10. Tableau Deep Dive: Parameters – Filtering Across Data Sources
  11. Tableau Deep Dive: Parameters – Bins
  12. Tableau Deep Dive: Parameters – Reference Lines
  13. Tableau Deep Dive: Parameters – Table Calculations
  14. Tableau Deep Dive: Sets – Introduction to Sets
  15. Tableau Deep Dive: Sets – Constant Sets
  16. Tableau Deep Dive: Sets – Computed Sets
  17. Tableau Deep Dive: Sets – IN/OUT
  18. Tableau Deep Dive: Sets – Combined Sets
  19. Tableau Deep Dive: Sets – Calculated Fields
  20. Tableau Deep Dive: Sets – Hierarchies
  21. Tableau Deep Dive: Dates – Introduction to Dates
  22. Tableau Deep Dive: Dates – Preparing Dates
  23. Tableau Deep Dive: Dates – More Date Functions
  24. Tableau Deep Dive: Dates – Exact Dates
  25. Tableau Deep Dive: Dates – Custom Dates
  26. Tableau Deep Dive: Dates – Rolling Dates
  27. Tableau Deep Dive: Dates – Calendar Filters
  28. Tableau Deep Dive: Dates – Week-by-Week Comparison
  29. Tableau Deep Dive: Dashboard Design – Planning
  30. Tableau Deep Dive: Dashboard Design – Layout & Structure
  31. Tableau Deep Dive: Dashboard Design – Proof of Concept
  32. Tableau Deep Dive: Dashboard Design – Adding Interactivity
  33. Tableau Deep Dive: Dashboard Design – Visual Best Practices
  34. Tableau Deep Dive: Dashboard Design – Optimization & Governance
  35. Tableau Deep Dive: Dashboard Design – Publishing
  36. Tableau Deep Dive: Table Calculations – Custom Sorts, Part One
  37. Tableau Deep Dive: Table Calculations – Custom Sorts, Part Two
  38. Tableau Deep Dive: Table Calculations – Custom Sorts, Part Three

More About the Author

Robert Curtis

Analytics Consultant / ANZ Practice Lead
An Interactive Guide to Public Toilets in Australia Traveling requires planning. Where do you want to go? How will you get there? Where will you stay? What will you eat? These are the ...
Tableau Desktop Now Available in Dothraki With aims to broaden their global customer base, Tableau Software (NYSE: DATA) announced today a Dothraki language version. The ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK