Quick and simple tip for dynamic tooltips

While working yesterday on this week’s Make Over Monday on winter Olympics, I ran into a dead end as I was trying to dynamically show the numbers of gold, silver and bronze medals won by each country in my tool tips.

In the data, the medal categories were easily identifiable by their given rank (1 for gold, 2 for silver and 3 for bronze), so I had initially thought of using the function CASE in a calculated field. It is a logical function that allows to check if a certain condition is met.

CASE [Medal Rank]
WHEN 1
THEN [Number of Records]
END

It did work, although when there was no record of that medal rank, it left an annoying blank space.

 

 

I did not have the time yesterday to search for a better option so I went ahead and uploaded my viz. I went back to it today and found out that what I was looking to achieve was even easier than that. A simple IF statement did the trick…!

IF [Medal Rank] = 3
THEN [Number of Records]
ELSE 0
END

 

It might be a very basic tip, but maybe it will help some with their next viz 😊

Author:
Gauthier Bonnot
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