
After last week’s tricky calcs that meant my solution didn’t match up, it was a welcome relief to get this challenge from Curtis Harris. Whilst some ‘seasoned’ #WorkoutWednesdayers may find this challenge very straightfoward, the main intention was to ensure everyone had been given an opportunity to implement the technique of sheet swapping.
I put myself into the seasoned category and have completed sheet swapping challenges in the past. In the past I would have been googling ‘tableau sheet swapping’ and referring to the raft of blogs & videos that provide you with the technique (maybe this one will become one of those in future!).
The challenge for me this time, was whether I could remember what to do without having to access previous workbooks or online references.
The answer was ‘yes’. I got through this in about 30 mins, which was very satisfying. So here’s what I did.
Build the Views
I created 6 views for this challenge; 3 for the main chart, and 3 for the preview.
I started by creating the Sales by Month line chart, applied all the various formatting to remove the axis & gridlines, set the tooltips etc. Once happy, I duplicated the sheet and changed the mark type to ‘bar’, then I duplicated again and changed the mark type ‘area’
I then named the 3 sheets line, bar , area.
Next I created a ‘preview’ chart. I duplicated the bar chart, removed the text from the tooltip, then added another instance of the date pill alongside to give me a secondary marks card, which I changed to be area.

I duplicated this chart 2 more times, changing the mark types so one showed a line and area, and another line and bar.
I named these Preview :Line, Preview: Bar and Preview:Area.
Show & Hide the Data
I created a parameter called Choose Display Type to store 3 string values : Line, Bar, Area.
The parameter won’t do anything until referenced within another field, so I created the following calculated field
FILTER: Display
CASE [Choose Display Type]
WHEN ‘Line’ THEN ‘Line’
WHEN ‘Bar’ THEN ‘Bar’
ELSE ‘Area’
END
I then navigated to the Line sheet created above, showed the parameter control and set the option to Line. Then I added the FILTER:Display field to the Filters shelf. The only option available to select is ‘Line’ , so I ticked it.

I then selected to ‘apply this filter’ to ‘selected worksheets’, selecting my Preview:Line sheet

Then I went to the Bar sheet. Again showed the parameter control, and changed it to ‘bar’. Then I added the FILTER:Display field to the Filters shelf. The only option available this time to select is ‘Bar’ , so I ticked it, and then ‘applied the filter’ to the Preview:Bar sheet too.
At this point, navigating back to the Line sheet, the display is blank because ‘bar’ is the selected option in the parameter, and this sheet is filtered to ‘Line’. Looking at the filter, you see as the parameter is set to bar, the only option for selection in the filter is also bar. As line <> bar, the data doesn’t show.

Finally I went to the Area sheet. Again showed the parameter control, and changed it to ‘area’. Then I added the FILTER:Display field to the Filters shelf. The only option available this time to select is ‘Area’ , so I ticked it, and then ‘applied the filter’ to the Preview:Area sheet too.
Adding to the Dashboard
So while the parameter is driving the visibility of the views, they now need to be added to the dashboard.
The trick is to use Containers objects. These can be a bit fiddly and take some time to get used to. If you haven’t used them before, I recommend you have a watch of Tim Ngwena‘s videos :
Tableau Layout Containers : Part 1 The Basics gives an overview of the types of container, and the UI appearance when using them and where to drag objects to.
Tableau Layout Containers : Part 2 – Tableau Menu Interface expands on the above with a particular use case.
I added a vertical container to the dashboard, and one of the first things I always do when working with containers is add a blank object. I then added the 3 initial charts (line, bar, area). Due to the parameter driving the hiding function, only one of these views actually displayed, although the title of each is visible, so you can see it’s been added. As a double check to make sure all are inside the same container, select one of the views on the dashboard (it will have a grey border when selected), then double click on the ‘handle’ at the top

This will then select the layout container the view is in, identified by the blue border

and you should see the 3 sheets + the blank object surrounded by a solid blue border, separated by dotted lines.
Test changing the parameter, and the appropriate sheet should display and the others hidden. Now hide the titles of each sheet, and remove the blank object. The displayed chart should look to fill up the whole space

The ‘preview’ sheets also need adding to another vertical container, but this vertical container needs to be positioned next to some text, so what I actually need first is a horizontal container.
I add the horizontal container to exist inside the same vertical container as the 3 sheets, so it’s at the bottom. The Item Hierarchy on the left nav bar of the Layout tab, helps show where items are positioned

The horizontal container has pushed the other objects up, but I’ll deal with that shortly.
I then add a text object into this container, then place another vertical container to the right of the text object

So now we have a vertical container inside a horizontal container, inside a vertical container. Phew! Once again double-clicking on the container handle will highlight the container the object is within to help you get to grips with the arrangement (I personally wish there was a way to see the layout by displayed lines in some way that don’t show on publication – a bit like the grid display, so you can get a better sense of the structure).
Now into this final vertical container add the 3 preview sheets.

and remove all the titles again, and test the parameter control.
Finally, the requirement is for the preview to be 50 pixels. Containers allow you to set the height for horizontal containers, and the width for vertical containers.
So select the horizontal container (either by selecting on the dashboard, or click the relevant horizontal container on the Item Hierarchy).

then choose Edit Height from the container menu accessible from the right hand side. Set to 50, and voila, the section shrinks.
My published version can be viewed here.
Happy vizzin!
Donna