Switch an Image with a Selection in a Tableau Dashboard

By: Eric Parker

Pro Headshot.jpg

Eric Parker lives in Seattle and has been teaching Tableau and Alteryx since 2014. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.

I was working on a project recently and wanted an image in the dashboard to switch based on user selection. I remembered a colleague doing this six years ago and for the life of me couldn’t figure out how until checking out this section of the Tableau community forum.

I’m going to share my findings here in an easy to follow format.

Let’s use the following dashboard as our example.

125-1.png

Imagine you want the image in the bottom right of the dashboard to change based on the icon selected at the top.

The first step is to create a new worksheet, create “X” and “Y” calculations that are just the number 1, and put the AVG of X on the Columns shelf and the AVG of Y on the Rows shelf.

125-2.png

Remove unnecessary formatting like the grid lines and set the opacity of the mark to 0 so the circle isn’t visible.

 
125-3.png
 

Fix the range of both the X and Y axes to go from 0 to 1.

 
125-4.png
 

Add the field that’s going to switch the images to both the Filters card and Detail on the Marks card. This step is super important! I forgot this later and couldn’t figure out why my visuals weren’t working until I went back and read the walk-through again.

 
125-5.png
 

Now, it’s time to start adding the background images. Unfortunately, they must be added one-by-one so this works well for a small number of images but probably isn’t going to scale well for hundreds or thousands.

To add the first image I will select “Map” on the toolbar, “Background Images” and then pick the related data source.

 
125-6.png
 

In the dialogue box that pops up, I’ll select “Add Image”, browse for the image and set the X and Y axes to have a minimum value of 0 and a maximum value of 1.

125-7.png

Next, I will select the Options tab in the dialogue, ensure both Image Options are checked on and add a filter so the image only shows when the Animal field is filtered to Dog.

 
125-8.png
 

Now the image add process can be repeated for each of the different images. Eventually the Background Image dialogue box will look something like this.

 
125-9.png
 

Now it’s time for some worksheet clean up like hiding the axis headers.

125-10.png

Finally, the worksheet can be added to the dashboard and when paired with a filter, the image will switch!

125-11.png

Hint, I find that I usually get the best visual experience by setting the dashboard action filter to “Leave the Filter” when the selection is cleared. That way multiple images aren’t trying to show at the same time when nothing is selected.

125-12.png

Feel free to download the Tableau workbook I built for this blog post here to explore and reverse engineer!

Need help building your own visuals? Reach out or book an office hour and we’ll help you get rolling!

Business Data Analysis in the Time of the COVID-19 Crisis

How to Make Dynamic Parameters in Tableau (New Feature)

0