Online tableau training, tableau tips, & video tutorials

Tips

Memberships

How to do Sheet Swapping with Tableau Layout Containers

Preview

Instructor

Ryan Sleeper

Switch between different charts with the click of a button

In this new and improved approach to sheet swapping, you’ll learn to toggle layout containers on and off by clicking on custom images. This approach is particularly useful for flipping between a visualization and its underlying data.

Hi, this is Ryan with Playfair Data TV. And in this video, I’m going to show you an easier way to do sheet swapping in Tableau compared to the traditional technique of using a parameter control combined with layout containers. This easier approach was made possible with a new feature that’s available as of Tableau 2019.2, which allows you to turn layout containers on and off.

This is one of my favorite techniques. Sheet swapping, in general, is one of my favorite techniques because it allows the end user to choose how they want to visualize a chart. To be honest, one of the most common ways I will use this is when I have an end user that is really comfortable seeing the raw data. So I will provide a sheet swapping method for them to look at a visualization that I’ve designed, but then they can toggle it and then see the raw data below if that’s more comfortable for them.

By the way, if you aren’t upgraded yet to 2019.2, I do share the traditional method for sheet swapping on another video called 3 More Ways to Smooth the Excel Transition. But the approach I’m about to show you is my new favorite approach. It works particularly well if you’re only flipping between two charts. So it could be used for the use case that I just shared, flipping between a visualization and a text table.

To illustrate, though, we will switch between these two charts. We’ll have a scatter plot that looks at Sales and Profit Ratio and bar chart. So little bit better than just the raw text table, but this bar chart represents the raw data for each dimension member in this scatter plot. We’re just visualizing it in a different way.

So to start with, so I’ve built those two sheets in advance. To use this method, those sheets both have to be added to a dashboard. So I’m going to start by dragging my primary view onto the canvas here. So Scatter Plot onto the blank white space. By the way, this also works best if you’re using floating objects because you can control the exact location and you can lay the layout container on top of the primary chart. So note that this is floating.

I’m going to drag Scatter Plot onto the view. And I’ll make this a little bit larger, maybe a 600 by 600 square. And we’re getting a little bit uncentered here. So let me do 200 in and 100 down. So primary chart’s on the view.

The next step for this new and improved way to do sheet swapping is to add a layout container on top of the primary chart with the exact same dimensions. You can use either a horizontal layout container or a vertical layout container. It does not matter. I’ll just throw a vertical container onto the view.

That blue border is telling me where the layout container is. This container needs to be the exact same dimensions as the underlying chart. So that was 600 by 600. And it was 200 pixels in on the x-axis and 100 pixels down on the y-axis. For best results, I recommend making the background of the layout container the same color as the rest of the dashboard. So in this case, I’m just using the default white.

So with this layout container selected, which I know because it has a blue border around it, from the Layout pane, I’m going to click on this background dropdown. And instead of the default none, I’m going to change that to white. Of course, the scatter plot has disappeared. We now have an opaque layout container on top of that scatter plot, but we will correct that in a minute.

The next thing we need to do is add the bar chart, so the secondary chart that I want to toggle on and off, inside of this layout container. So Bar Chart, I’m just going to drag it onto the view. Hold the Shift key. The gray shading has now changed to show me that it’s going to fill that vertical layout container that I added in the last step. If I let go, the bar chart is now inside of that layout container. I will make this fit the entire view to get rid of my scroll bars. And we now have a secondary or detailed chart inside of a layout container with an opaque background laying on top of my primary view.

To bring this to life and make it work, we’re going to use a new feature available as of 2019.2, which allows you to toggle a layout container on and off. To do so, you first need to make sure you have the layout container selected. Right now, I have a gray border around a single chart telling me that that one sheet is selected. The easiest way to select the layout container is to double-click on this gray rectangle.

Notice the gray changed to blue. The blue is now telling me that I have selected the entire container and not just that one individual sheet. Now if I click this down arrow, there’s a new option. It says Add a Show or Hide Button. I’m going to click on that. By default, we see an X.

And by the way, this is already working. It doesn’t work unless you go to a Presentation mode. But just to show you that it is already working, I’ll go to Presentation mode. And by default, you will see an X when the container is being shown. If I click on that X, it will hide the container, and the button will change to a menu looking icon. That means that the container is closed.

So right now, container is closed. The bar chart on top is hidden. If I click this button, it will toggle that container back on, bring my bar chart back into the view. So that’s already nice. It’s already working. You could stop there if you want to.

But I also wanted to show you that you can customize these images. For me, this is an awesome improvement within Tableau. This is allowing us to integrate other products, particularly to help with the design and user experience of the dashboards. But you can now essentially design a button that looks how ever you want. And then you can edit this button and map different images for when that container is being shown or hidden.

So right now, when it’s being shown, I might want to choose a different image. I mean, this isn’t bad. It’s a very nice default. You saw how quickly we were able to make that. But to improve the user experience, maybe when this container is being shown, I’d like to show a little icon of a scatter plot that implies to my end user that if you click on that button, it will turn into a scatter plot.

Well, now if I click this Choose button, I can select or map any image that I want to this button for when that container is being shown. So if I click Choose, go find the file that I want to show, I’ll choose a scatter plot icon when the container is on. And I can also map an image to the button for when the container is hidden. So just to point this out, we’ve got scatter plot icon for when the item is shown. If I click item hidden, notice it went away, and it’s telling me to choose an image for when it is hidden.

Well, when that container is turned off, I want to show a bar chart icon implying that if you click on that button, the bar chart will reappear. So I click Choose, click the bar chart icon. And now when the item is hidden, we’ll see the bar chart picture. When the item is shown, we will see the scatter plot picture. I’ll go ahead and click OK.

And I guess, let me stop there and point out a couple more things. You could also add a tooltip. This is handy to provide a call to action. So I could say, “Do Sheet Swapping!” or whatever you want to do, and these instructions will appear when the user hovers over that button. There’s obviously a couple of other options, but we’ll call this good for now. I’ll click OK.

That’s pretty small. So another thing I’ll point out is these buttons are their own objects now. So just like any other floating object, if I go to the Layout pane, I can change both the dimensions of that floating object as well as its exact location on the x and y-axis. So I just made that icon a little bit bigger. Maybe I’ll drag it so that it’s kind of in line with the right side of my chart.

I’ll go to Presentation mode to test this out one more time. As you can see, we have the layout container open showing us the detailed information of that scatter plot. If you click on the scatter plot button, the container will close. There is my call to action when I hover over the button to tell the end user what’s going to happen. When I click on it, the chart got swapped out, quote, unquote, “swapped out.” This is the new and improved way to do this.

But really what happened is we just turned off the container that had our bar chart inside of it. Now it revealed the underlying scatter plot. This was our primary chart. So here’s where the end user would land. If they’re not comfortable seeing it in this way and they want to get back to that raw data, the icon for the scatter plot has also been swapped out for a bar chart. And if I click on that, the container will reappear. They get their detailed information.

This has been Ryan with Playfair Data TV – thanks for watching!

Tips Videos
  1. How to Dynamically Format Numbers in Tableau
  2. How to Conditionally Format Individual Rows and Columns in Tableau Like You Can in Excel
  3. How to Allow Users to Choose Dimensions and Measures in Tableau
  4. Exercise: Sales by Category, Region, Segment, or Ship Mode
  5. How to Color Entire Tableau Charts Based on Current Performance
  6. How to Color and Size Entire Tableau Table Rows
  7. Using Tableau’s INDEX() Function for Easier Top N Filtering
  8. How to Make Tableau Histograms with Aggregate Calculated Fields
  9. How to Make Dynamic Tooltips in Tableau
  10. How to Add an Image to a Tableau Tooltip
  11. How to do Automatic Anomaly Detection in Tableau
  12. How to Make Rounded Gauges in Tableau
  13. How to Add a Tooltip to a Dimension in Tableau
  14. Two Ways to Make a Tableau Timeline when Events Overlap
  15. 3 Creative Ways to Use Transparent Sheets in Tableau
  16. How to Automatically Change Number Units in Tableau
  17. How to Drill into a Single Row in Tableau
  18. A Formatting Trick for Tableau Scatter Plots and Maps
  19. How to do Sheet Swapping with Tableau Layout Containers
  20. How to Use Measure Names in Tableau Calculated Fields
  21. How to Use Control Sheets for Better Parameter Actions
  22. How to Deduplicate Joined Rows in Tableau
  23. How to Add Vertical Connecting Lines to Tableau Slope Graphs
  24. How to Align Text Like Finance Reports in Tableau
  25. How to Show Top N Lists in Tableau Tooltips
  26. How to Flexibly Format Decimal Places in Tableau