Tinkering with Shapes & Tree Maps

Written by guest contributor Simon Runc….

Following a bit of time spent on the community, and a bit spent Tinkering in Tableau I came across a rather nifty trick, and then an even niftier use!…So, I thought I’d put a quick Viz together to share with the wider ‘Tableau’ world.

The basic trick is put shapes directly into a calculated field, taking advantage of the fact you can use any ASCII character as the string return of a calculation…and many ASCII characters are things like Arrows/Stars…etc.

The basic trick is shown below
CASE [Status]

WHEN ‘Green’ THEN ‘▲’

WHEN ‘Red’ THEN ‘▼’

WHEN ‘Yellow’ THEN ‘►’


…It’s that simple.

This also has the knock on advantage of not messing up your Shape assignment when switching data sources (which seems to occasionally happen)…the only disadvantage is that you only have access to ASCII characters and not any image (as you can by importing custom shapes). Speaking of which…check this place out http://www.flaticon.com/

I was then asked a question about putting shapes in Tree-maps…and the 2 events were close enough together for the grey matter to put 2 and 2 together and get 4!

Simon 4

In this example, I’ve taken this one step further by employing a second trick to Colour the shapes depending if they are Up or Down (the measure is the Year on Year performance).

For those who haven’t come across this (and can be used in ToolTips too)….

  • You need to create 2 fields (assuming you just have 2 colours to display, but in theory you can have as many as you want). One for when the result is positive, and one for when it is negative
  • In my example here I’ve created ‘KPI Up’ and ‘KPI Down’

‘KPI Up’: IF [YoY Sales 2013 vs 2012] >=0 THEN ‘▲’ END

‘KPI Down’: IF [YoY Sales 2013 vs 2012]

Notice that there is no ELSE statement, which means if the condition isn’t met it equates to NULL, and Tableau doesn’t (…well can’t) Plot NULLs

Handy Tip: Tableau not plotting [or counting] NULLs is a very useful thing to know, and one I exploit very frequently

  • We can then drag these 2 fields on to the Label Tile, and arrange as follows

Simon 2

As you can see I’ve taken this one step further and created 2 fields (in the same way) for the actual results too.

You can access the workbook (8.3) on Tableau Public

Or from the Community


I can see this technique could have many other applications, and from a Visualisation point of view it gives the viewer one extra piece of information, without compromising the goal of the Viz. For example in my example, I now also can see (as well as the scale and profitability of the various categories) the Year on Year movement.

Happy adding shapes to everything!!

One comment on “Tinkering with Shapes & Tree Maps

  1. puspak2nP says:

    Saw this Tip somewhere
    We can Format the Numbers to Display Up/down arrow:

    “$”#,##0.00 ▲;(“$”#,##0.00) ▼


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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s