Tableau - Discovering Case, When and Then

I recently created and uploaded a dashboard to my Tableau Public account comparing 8 different Quarterbacks in the NFL and their performance during the first 17 games of the season (which can be found here: https://public.tableau.com/app/profile/sam.search/viz/WhichQuarterbackinthePlayoffshadthebestRegularSeason/WhichQBinthePlayoffshadthebestregularseason2). Part of my idea for this dashboard was to have a parameter which changed the sheet that would display between one of three scatterplots and at the same time change the two BANs associated with those charts. The below gif hopefully helps to visualise that description!

Updating the top two numbers as appropriate.

Initially, I tried formatting the BANs in the same way that the sheets updated i.e. by putting them all into one container which would update accordingly when the parameter was changed. However, I had quite a few issues with trying to essentially place 6 BANs into one container and getting them to display correctly. Fortunately thanks to some help from the team at TIL, I was introduced to the idea of using CASE, WHEN and THEN to help with this. Essentially this meant that I only needed to ever have 2 BANs on the dashboard and they would instead update dynamically.

All I had to do was make 2 calculated fields and put them into a sheet as text. These looked like so (and a similar field for the name to display):

So the number that I wanted to display would only appear when looking at a certain chart. For example the Average Touchdowns of my 8 players would display when the parameter was set to 'TD to Interception'. The other metric was then set to the Average Interceptions and named in a similar fashion.

This was really useful to learn as someone who's first thought is almost always to create an 'IF' statement in a calculated field as an alternative way of doing BANs and making them more dynamic on a dashboard and hopefully might be helpful for anyone else to consider moving forward.

Author:
Sam Search
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
© 2025 The Information Lab