Hi all,

We are back with another guest blog! It’s my pleasure to invite Lisa Trescott onto the site, someone in the community that many of us admire and shot to Tableau royalty winning the IronViz competition back in 2021. More recently Lisa put out a post using an accordion menu to create drop downs of different chart types and kindly agreed to share the process behind it with us all.

Over to Lisa to talk us through the process.

My favorite feature in Tableau is parameter actions because they allow you to do so many cool things with your user interface. Now we have dynamic zone visibility, and the two together are a match made in UI heaven!

Recently, I was grappling with a way to fit multiple charts on a single dashboard without making the dashboard too large. I remembered a viz by Zak Geis in which he created an accordion menu, and I thought that could be just the ticket. He used parameter actions to show/hide single sheets in his workbook, but I needed to be able to show and hide entire containers of charts, descriptive text, and legends. Enter dynamic zone visibility (DZV). With DZV you can show and hide containers full of content, and when paired with parameter actions you can create powerful UI experiences.

I started by looking at examples of accordion menus to get design ideas. Here are a few that served as my inspiration.

Fairly similar in style, both have a way of recognising the different element you are clicked on through the use of colour and side border.

And here is my version in Tableau

You can download a copy from the top link in the page or clicking here.

To start building this, create a parameter to control the sections of the accordion menu. My parameter has values 1 through 4 because my accordion has 4 sections. If you have more or fewer sections, you will need to add/remove values.

This parameter will control the DZV on the dashboard. Dynamic zones require a field or parameter to control them, and that field/parameter must be Boolean, a single value, or a field that returns a constant value (like a fixed LOD). I used Boolean fields and made 4 calculations that result in true/false when selected/not selected by the parameter.

p.section 1

[Accordion Param]=1

p.section 2

[Accordion Param]=2

p.section 3

[Accordion Param]=3

p.section 4

[Accordion Param]=4


Section Headers

Each section header is a dual axis chart with MIN(1.0) as a bar and MIN(.95) as a shape.

The bar chart acts as a background that changes color when the section is selected. For each header, the corresponding “p.section [n]” calculation is placed on color.

  • section [n] = TRUE returns white (#ffffff)
  • section [n] = FALSE returns light grey (#f5f5f5)

The label for each section header changes color based on two calculated fields:

p.Section 1 color_true

IF [Accordion Param]=1

THEN ‘Sales by Month’



p.Section 1 color_false

IF [Accordion Param]<>1

THEN ‘Sales by Month’



Note: You will want to use the name of your own sections in place of “Sales by Month”.

Place these fields on label and format them appropriately:

The shape mark uses p.section [n] on Shape with the following two custom shapes assigned to true and false. I used a purple up shape and a down grey shape.

These header sheets will work in conjunction with parameter actions on the dashboard. This means we need the parameter value to be on Detail so it will get passed to the corresponding parameter action on the dashboard. Each section header corresponds to a number, so place the MIN of that number on Detail:

  • header_section 1 = MIN(1)
  • header_section 2 = MIN(2)
  • header_section 3 = MIN(3)
  • header_section 4 = MIN(4)

Place two dummy fields on Detail. I use dummy fields equal to ‘0’ and ‘1’, but these fields can be any values (as long as they are different from each other). More on the purpose of these dummy fields later.

Build a header sheet for each section of your accordion.

Color Block

One of the accordion menus I found as inspiration had a colored line on the side of the section when it was selected. I wanted to emulate that, so I created a sheet to act as that colored line.

Create a bar chart using MIN(1). We have already used p.section [n] on color, so if we use it again it will return the same grey and white color that has been previously assigned. To get around this, place two measures on color: p.section [n] and a dummy field. We could also duplicate p.section [n] and use the copy on color to achieve the same result. If the section is selected by the accordion parameter, the color is set to purple (#5b42c6). If it’s not selected, the color is set to light grey (#f5f5f5) to match the header’s background.

Build these color block sheets for each section of your accordion.

Putting it Together

Each section of the accordion menu is composed of the following elements.

Header Container (remove all outer padding)

  1. Sheet: color_section [n]
    1. Sheet: header_section [n]
      1. Remove all padding
      2. Edit width to 3
  2. Chart Container (remove all outer padding)Note: this whole container is controlled by dynamic zone visibility
  3. Blank object
    1. Remove all padding
    2. Set color to purple (#5b42c6)
    3. Edit width to 3
  4. Chart

Tip: Build out all your containers before you place them into your accordion menu container. It is also helpful to name your containers in the layout pane.

Place all containers into a large master container that will house all the headers and sections.

Note: I also placed a blank object between each section break (no padding, height is set to 1, color is set to grey (#e7e6eb)).

The accordion menu is taking shape now, but it looks very cramped and messy. Don’t worry! Once we add DZV controls it will all fall into place.

Select the container housing your section 1 chart, navigate to the layout pane, and click “Control visibility using”. Select the variable that corresponds to that section (p.section 1).

Repeat these steps for all sections.

Parameter Actions

Each header has a parameter action associated with it. For a parameter action, you need to select the source sheet (i.e., the sheet you’re clicking to change the value of the parameter), the target parameter (i.e., the parameter that is being controlled by the action), and a source field (i.e., the value that gets passed to the parameter). Note the “source field” will be MIN(1), MIN(2), MIN(3), MIN(4) to correspond to the header value in the accordion parameter.

Create actions for all 4 headers.

Filter Actions

When you select something in Tableau, it will remain selected until you click somewhere else. We want to override that, otherwise the menu will look like this upon selecting a header:

We want it to have a more seamless interface and look like this

Remember those dummy fields we put on Detail? This is where they come into play. Create a filter action that runs on select of header_section 1. For target sheet, select header_section 1. Select “Show all values” when the selection is cleared. Under “selected fields”, make your source and target fields your dummy 0 and dummy 1 fields.

Create filter actions for all 4 section headers.

And there you have it! An accordion menu built entirely in Tableau using parameter actions and dynamic zone visibility. I hope you have fun playing around with this concept and making other designs and variations of this menu. I’d love to see what you come up with!

CJ Round-Up:

Wow! How exciting! A good one for those wanting to utilise dynamic zone visibility and parameter actions in a really effective way.

Be sure to check out Lisa’s profile, and if you have any questions reach out via Twitter.