Skip to Content

How to implement a Parameter in Tableau that will accept multiple inputs at a time

Blog | December 1, 2022 | By Shaswath Thunga Devraj, Abhishek Ranjan

Introduction

We were working on a project in which the requirement was to pass multiple values as input to the parameter. In the same Project for a few dashboards, we faced challenges while developing the dashboard because of huge data. It was taking too long to execute any command and therefore it was very difficult to build the dashboard either using live connection or using an extract.

To overcome the above problem and meet the requirement, we came up with the below solutions: 

  • By using CONTAINS() Function
  • By using INSTR() Function 

By using CONTAINS() Function

CONTAINS is a Tableau function with the help of which we were able to pass multiple values as input to the parameter.  

Please follow the below steps to create a parameter in Tableau which will take multiple values as input. 

Step 1: 

Create a string parameter and default it to blank

Step 2: 

Create a calculated field as below 

Department ID Calc = CONTAINS ([DEPARTMENT ID], (Department ID))  

Here “[DEPARTMENT ID]” is a Tableau Parameter and “Department ID” is the corresponding column from the database to which we want to apply this parameter

Step 3: 

Bring Department ID Calc to filter shelf and filter it to True

Step 4:

Pass multiple values with any delimiter through DEPARTMENT ID parameter

Limitations and workaround for it

  • CONTAINS() Function works only with those fields which are having string data type.  
  • INSTR() function will overcome this limitation.

By using INSTR() Function

For those dashboards in which we were facing challenges because of huge volume of data, we restricted the data by using parameters in custom SQL query. But when we used parameters in custom SQL query,  we were not able to use CONTAINS() function to pass multiple values as input to the parameter. In this case, we used the INSTR() function to meet our requirements. 

NOTE: INSTR() function will work only with the ORACLE database. 

Please follow the below steps to make a parameter in tableau which will take multiple values as input.  

Step 1: 

Fetch the data from the ORACLE database using custom SQL query.

Step: 2

Create a string parameter and default it to blank

Step 3:

Use the INSTR() function and modify the custom SQL query.

Here “<Parameters.DEPARTMENT ID>” is a Tableau Parameter and “DEPARTMENT_ID” is the corresponding column from the database on which we want to apply this parameter. 

Step 4: 

Pass multiple values with any delimiter through the DEPARTMENT ID parameter.

NOTE: If user wants to search data based on only few characters and get the corresponding result, we can follow below approach. 

Step: 1 

Create a string parameter and default it to blank

Step 2:

Use SUBSTR() with INSTR() function and modify the custom SQL query.

Here “<Parameters.Email>” is a Tableau Parameter and “EMAIL” is the corresponding column from the database on which we want to apply this parameter. 

Step 3: 

Pass multiple values with any delimiter through the Email parameter.

author image
About the Author
Experienced Software Engineer with a demonstrated history of working in the information technology and services industry. Skilled in Teradata, Tableau, Alteyrx, Oracle, Unix, and Snowflake.
Shaswath Thunga Devraj | Technical Lead - Visual Analytics | USEReady
author image
About the Author
Dedicated and highly motivated professional with experience in Data Visualization and analytics. Passionate about turning data into actionable business insights and hands-on with designing, developing, and supporting solution-driven Tableau dashboards.
Abhishek Ranjan | Associate BI Analyst - Visual Analytics | USEReady
Back to top