Refer to different sheets in a tooltip

[Edit: The following sadly only works in Desktop and will not work once published to Server, Online, nor Public. Thanks to Ken Flerlage for pointing this out.]

It is possible to show different sheets in a tooltip depending on which mark you hover over. The trick is to use the Tableau code generated from inserting a sheet into a tooltip within a calculated field.

Here’s the code, shown in the tooltip, when selecting “Insert > Sheets > Discount.” (Where “Discount” is the name of the sheet being inserted.)

Next, do this same thing again, but now insert the sheet “Profit-Ratio.” There should now be two lines of code, one for each sheet.

Then what you need to do is copy and paste the code into a calculation with a conditional statement:

If true, the calculation will display the Profit-Ratio sheet, and if not, the Discount sheet. (The condition I have here is simply for the sake of example. You can write whatever conditions or parameters you like for your own use cases.)

The last thing we have to do is put the calculation in our tooltip.

Now hovering over marks with sales less than 150000 will show the Discount sheet, and marks with sales above will show the Profit-Ratio sheet.

I look forward to seeing what kinds of things can be done with varying sheets in tooltips!

For a complete walk through, check out the video:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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

%d bloggers like this: