Period Comparison with Set Actions in Tableau


Period Comparison with Set Actions in Tableau

Tableau is constantly evolving. It does not chimera itself into a beast with three heads, wings, a tail, 16 arms, scales and a blowhole. Rather, it stays true to itself while making itself stronger and better aligned for its target market. Set actions are a great example of this.

This dashboard involves a few different tricks put together:

  • Set Actions
  • Sheet Swapping
  • Tooltips: Allow Selection by Category
  • Tooltips: Dynamic Text

Set Actions

I’ve created two different set actions: one controlled from the left side (Period 1) and one controlled on the right side (Period 2). However, these charts change based on your parameter selection. The parameter selection changes what type of dates we are looking at daily, weekly, monthly, quarterly and yearly. This means the dates that are being added to the set action are also changing.

Here is where I had to be careful … I needed a way for all my various dates to be linked together. To do this, I created a parameter that would feed a calculation. This calculation would look up the custom dates. The custom dates were used because they return a single day—a day is shown as one day, a month is shown as one day, a year is shown as one year—because each interval is reduced to the first of that interval with the DATETRUNC() function.

Because of this, while swapping between the various parameter options, the charts will appear to already have some data selected. Thus, this calculated field and parameter became the backbone of everything that followed. These tricks could have previously been created using a normal filter, but it would have been impossible to compare the size of the values against each other and more difficult to compare the in/out together within each period selection:

edit parameter date comparison intervals in Tableau

data comparison intervals in Tableau

Sheet Swapping

The sheet swapping trick is an old, but fun, trick. I use it a lot to get dynamic and creative layouts for dashboards. There is a great blog written by my colleague Robert Rouse on how to do this.

Tooltips: Select by Category

In the below example, I’ve hovered over a single date. What if I want to see all of January easily? Simple! Just click on bold text for January. What if you needed to compare the third of each month? Easy! Just select the bold 3. You can do the same for Tuesday and for 2012:

tooltips selecting by category in Tableau

When highlighting all the Tuesdays, you get this chart:
comparing dates in Tableau

Tooltips: Dynamic Text

I think we’ve seen parameterised text quite often. In this case, I created a few calculated fields. These all begin with the name Format. The first one is quite straightforward. It’s used to make the tooltips look better. Instead of 2 of May, I wanted it to say 2nd of May. To do this, a calculated field that looks at the last digit is used. This last digit is checked, and based on the outcome, you get a suffix:

calculated field in Tableau

The next formatting trick for this Dynamic Text is the ‘Period 1 Says Helper.’ Period 2 has its own as well! It looks like this:

dynamic text in Tableau

The text needs to be variable in my tooltip so that it makes sense. When I have multiple dates in my set, I want to compare the value to it. When I don’t have multiple selected, I want to just report the value instead of comparing it.

KeepWatch by InterWorks

Whether you need support for one platform or many, our technical experts have you covered.

More About the Author

Carl Slifer

Analytics Consultant
Using Relationships for Data Densification: Map Coverage Often, clients want to show a geographic area of their coverage for some services. This might be countries per region or sales rep, or ...
Parse and Pivot Concatenated Datasets Using Only Tableau Desktop Recently, one of my colleagues had an interesting issue with a client’s request. The client they were working with was getting a file ...

See more from this author →

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


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072


Love our blog? You should see our emails. Sign up for our newsletter!