Tableau Tooltips: Conditional Formatting

This is the second post about tooltips. In this post, I will describe a technique to add conditional formatting, of a sort, to your viz. This isn’t a natively supported feature in Tableau (although it would be lovely if it was!), so you have to do a bit of extra work to do it.

I’ve implemented colour-based conditional formatting in a few Tableau Public dashboards. My disc golf analysis dashboards use colour to emphasise the good/bad performance of players. Click here to go to the viz; the tooltips are below.

If the player played better than their rating, they’d get this tooltip:


If they played worse, they’d see this tooltip:


I’ve also used colour to represent a political party’s colour, as shown in my UK General Election viz. The main dashboard is here, but I’ve embedded one of the worksheets below. Hover over the different parties (Labour, Conservative, etc) to see the different colours in the tooltips:

There are a few limitations to using colour. Essentially, this boils down to having a Dimension or Group where the possible values are known ahead of time and are relatively small. Why’s this? Because to take advantage of conditional tooltips, you need to create a specific calculated field for each Dimension value.

Here’s the steps to create the coloured Party tooltip in the General Election dashboard.

  1. Determine the list of items that will need their own colour. For our general election, there are four. One for each of the three main parties: Labour, Conservative and Liberal Democrats, and one  for everyone else (Other)
  2. We need one calculated field for each of the four values. It is a basic IIF function that either returns the Dimension value as a string, or an empty string (note – it must be an empty string, not Null).
    In my dataset, the underlying party column was a single letter, so the calculated field for Conservatives was this:
    Cond format calc field
  3. Duplicate that calculated field for each Dimension value, until you have all the ones you need:
    Calc fields in dim list
  4. Now put all four of those fields onto the Level of Detail shelf:
    Level of detail
  5. The final step is to edit the tooltip. This is quite straightforward, but looks a bit messy. Order the calculated fields so that they are all adjacent in the tooltip text. Format each calculated field with the colour that you want. For the election tooltip, this looks like:
    The tooltip

That’s it! All but one of the calculated fields will be Null at any one time (since you can’t hover your mouse over more than one mark at a time). Therefore, despite there being four items in the tooltip, the viewer only ever sees one. And it just happens to be in the correct colour. Bingo!


Add Yours →

Hi Andy,

That is outstanding. Thank you for posting that, I’ve already started making use of this approach

One question: Is there a way to exclude the Conditional Dimensions when you exclude to Excel (i.e. to Crosstab)? I’m guessing the answer is no, but thought I’d ask.


Hi Jamie
That’s a good question. I hadn’t considered what downloading the underlying data would be like. You’re right- no, you can’t prevent those c.f. fields being in the underlying data, as far as I know.

Does anyone know a way to exclude totals from conditional formatting? I want totals displayed on my table, but they dominate the conditional formatting – i.e. the totals are all bright green (since they are largest values).


I am working on a a Report that needs conditional formatting by color.

For Example: I have two sets of numbers for the same measure form two different sources and I am showing the variance between the twpo sources.

Source 1 has 5200
Source 2 has 5000
Variance = 5000/5200=96%

I need a formula that says if variance =100% than [display in green font]

Does anyone have any suggestions?


Is there a way to get a description by different dimensions
Example: I have 3 different measures “Customers for 2012”, “Customers for 2011”, “%Change” etc. I would like to include the description for the measures in the tooltip or any other place. And when I hover over the column it would show me the metadata of the column.

Leave a Reply