Tableau tool tip tip week - Dynamic symbols in tool tips

Tool tips are an extremely useful way to provide your users with additional information which help further or provide context for any points that you are tying to make within your visualisation.

So to celebrate blog-a-day week here at The Data School I have decided to focus this 5 piece blog series on ways to maximise the impacts of tool tips.

Last week I published my ‘UK Planned Public Expenditure | 2015-16‘ visualisation. One of the aspects included in this viz was a tool tip that provided context to my users by providing previous year data.

Fellow DS2 student Rob Suddaby highlighted the use of symbols in tool tips (specifically how they are dynamic and change based on whether a figure is positive (up arrow) or negative (down arrow)) and requested I blog on the subject… well Rob (and my other readers!), here is the answer…

Picture2

 

For the purposes of this example I will be using the EU Sample Superstore data set that comes with Tableau, so if you wish to follow along then just open that up! I will be focusing on the difference between 2013 and 2014 sales (a step by step guide is provided beneath the video!).

  1. We need to create our 2013 and 2014 sales data. We have an ‘Order Date’ field and a ‘Sales’ field so i’m just going to write two simple calculated fields and call them ‘2013 Sales’ and ‘2014 Sales’.2013 Sales – IF YEAR([Order Date]) = 2013 THEN [Sales] END

    2014 Sales – IF YEAR([Order Date]) = 2014 THEN [Sales] END

  2. Write a calculated field that works out the difference between  these two values (and thus what our dynamic symbol will show)Difference – Sum([2014 Sales]) – Sum([2013 Sales])
  3. Right, here’s the secret… you can use symbols within a string in tableau… so knowing this all we need to do is write a formula…Symbol – IF [Difference] > 0 THEN “▲” ELSE “▼” END

    Drag this onto your tool tips alongside any other information you may wish to add and you have your dynamic symbol.

    (other symbols are available and just a quick google away)

  4. Now just a couple of extra things…a) Is it really necessary to have a ‘-‘ value in front of values that already have a ▼ indicating that it is negative change… probably not. So we just need to wrap an ABS (absolute…positive) function around our difference… BUT WAIT, down overwrite it otherwise our symbol will then always be pointing upwards. Make sure you duplicate your difference calculated field, make the amendment, then drag this knew field on to the tool tip.

    Absolute Difference – ABS(Sum([2014 Sales]) – Sum([2013 Sales])

    -Dow n

    b) Is it possible to make these symbols change colour based on whether they are up and down? I didn’t know the answer until today, but yes, of course there is, this is Tableau after all. You will have to create two further calculated fields mind…

    Up Arrow – IF [Difference] > 0 THEN “▲” ELSE “” END

    Down Arrow – IF [Difference] > 0 THEN “” ELSE “▼” END

    Then drag both these into your tool tip and format the ‘Up Arrow’ field as green and the ‘Down Arrow’ field as red…

    (disclaimer… I have committed the cardinal sin of using red and green in the same viz…NEVER DO THIS)

    GreenRed

I hope this blog has proven useful and added to your Tableau knowledge, writing it certainly has mine.

There are 4 more blogs to come in the Tableau tool tip tip week so hopefully we can be tool tip experts by the end of this week.

Ben

Author:
Ben Moss
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab