How to Dynamically Swap Metrics and Change Data Points in Tableau

How to Dynamically Swap Metrics and Change Data Points in Tableau

One of the most attractive characteristics of Tableau is its intuitive and user-friendly features that allow users to gain control of their reports. One such powerful feature is that of Parameters.

“ The key is, no matter what story you tell, make the Buyer, the Hero” — Chris Brogan

One of the most attractive characteristics of Tableau is its intuitive and user-friendly features that allow users to gain control of their reports. One such powerful feature is that of Parameters.

Parameters allow the creator or user to prepare for varied scenarios, allowing users to pass in values to modify the visualization in question. Here the user or audience is in the position to control the input to see the parameter effect on the visualization.

Tableau defines parameters as_ ‘a global placeholder value such as a number, date, or string that can replace a constant value in a calculation, filter, or reference line’_

Outlined below are two different ways in which you can use parameters in your visualizations and reports to make them more user friendly and efficient.

Dynamically Swapping Measures or Metrics:

Many times, if a dashboard or a report caters to multiple audiences/users, you would notice, each of them individually is concerned with different metrics and different data points.

For such cases, swapping of measures or metrics plays an intelligent yet elegant role of showcasing multiple metrics in a single report or dashboard, furthering efficient use of space and analysis of several measures at a glance.

Follow the steps below to create a swapping measures feature in your report using a parameter -

In the example below I wish to switch the _Sales _and the Profit metrics or measures over time.

Additionally, I have used the Sample Superstore dataset in all of the examples. (https://community.tableau.com/s/question/0D54T00000CWeX8SAL/sample-superstore-sales-excelxls)

Step 1 — Create a viz/chart for first measure/metric

Open up a new worksheet and create a visualization or chart for your first measure. In the image below, I have created a time-series, or a line chart based on sales, indicating a trend of sales over time.

![Image for post](https://miro.medium.com/max/2876/1*ogA0JVG0TGNbN0GPkcStkQ.png

Step 2 — Create a Parameter

Click on the dropdown alongside the Dimensions pane and select the Create Parameter option.

Image for post

Provide a meaningful name, change the Data Type to Integer and change the Allowable values to List

Under the List of Values *pane, add the values in a linear fashion starting with 1 and under the *Display As column, provide a meaningful, metric indicative name, such as Sales over Time and Profit over Time.

You can add multiple such measures or metrics based on your preference and use case, since I want to switch between sales and profit, I have added just the two.

Image for post

Step 3 — Create a Calculated Field

Click on the dropdown alongside the Dimensions pane and select Create a Calculated Field option.

data-visualization data tableau data-analysis data-science data analysisa

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Tableau Data Analysis Tips and Tricks

Tableau Data Analysis Tips and Tricks. Master the one of the most powerful data analytics tool with some handy shortcut and tricks.

Exploratory Data Analysis is a significant part of Data Science

Data science is omnipresent to advanced statistical and machine learning methods. For whatever length of time that there is data to analyse, the need to investigate is obvious.

Stolen Bike Visual Analysis using Tableau

Interactive Tableau visualizations for a stolen bike dataset in the United Kingdom for the years 2014 to 2017. Here, I have used “Tableau” for working out my visualizations and let us see how easy and visually appealing these charts and graphs be.

What Are The Advantages and Disadvantages of Data Science?

Online Data Science Training in Noida at CETPA, best institute in India for Data Science Online Course and Certification. Call now at 9911417779 to avail 50% discount.

50 Data Science Jobs That Opened Just Last Week

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.