top of page

Using parameter to swap between different visualizations (e.g. between bar and area chart)

Writer's picture: Bernard KilonzoBernard Kilonzo
Using parameter to swap between different visualizations

In one of the previous articles in this platform, I showed you how to swap between views using a parameter and a layout container. This approach was a little bit a process and required us to create a dashboard to materialize that.

In this article, I would like us to take a different approach – whereby instead of using parameter, layout container and dashboard layout. We are going to use a parameter and a calculated field to enable viz swapping within the worksheet level. For this case we are going to create a view in which users can swap between a bar chart view and an area chart view.

Create a parameter.

Create a string parameter ‘Select chart type’.

Creating parameter in Tableau

Create the first view – a bar chart.

To create the first view, lets create the calculation ‘Bar chart view’.

tableau calculated fields

Create the view by dragging Sub-category to the columns and the calculation ‘Bar chart view’ to the rows. Choose Bar chart under the marks card.

column charts

Create the second view – an area chart.

To do that create the calculation ‘Area chart view’ as shown below.

tableau calculated fields

Drag this calculation to the view, make the chart dual axis and synchronize the axis.

column charts

Under marks card of the second view – ‘Area chart view’, choose ‘Area chart’.

Show the parameter control and select ‘Area’.

area chart

Note now the view can change from Bar to Area chart and vice-versa based on your selection on the parameter control.

interactive column and area chart

In a nutshell, that is the second way you can swap between different visualizations using a parameter and a calculated field.

I hope this article was somewhat helpful to you. To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.

Thank you for reading.

Original.png

We Support You Deliver Business-Focused Solutions That Enable Data-Driven Decision Making.

  • Tableau profile
  • YouTube
  • White LinkedIn Icon
  • Facebook
  • X

QUICK LINKS

CONTACT US

+254 738 307 495

East Gate Mall, Donholm

3rd Floor Suite No. 3i

Nairobi, Kenya

Join our mailing list

bottom of page