Passing Database Parameters In Tableau

Data

Passing Database Parameters In Tableau

In my first InterWorks blog post, I’ve decided to write about something that I commonly used in other BI platforms. The idea of passing parameters in Microsoft and IBM products is vastly used in reporting. A user can define their parameter before running the report. Examples of such parameters are Start Date, End Date, Region, etc. Using database parameters in Tableau is not ideal, as custom SQL needs to be implemented.

The biggest drawback to using custom SQL as a connection is that it becomes a sub-select to every query Tableau runs against every Tableau view. However, the advantage of using custom SQL and parameters is that they will limit the data returned to Tableau. This method would increase performance in most cases, depending on the back-end data architecture and the size of the data itself. 

A Tableau Use Case

I recently came across a great use case to implement this in Tableau. I was querying over 500 million records using a live connection and custom SQL. The calculations for a particular measure were always dependent on the Start Date and End Date selected by a user. These calculations could have been dynamically calculated inside of Tableau, but the large data set caused performance to take a significant hit.

Since a well-implemented back-end architecture was in place, it was favorable to push all calculation to the database end. Depending on the Start Date and End Date, the data was then limited and easier to query. This process helped in enhancing both performance and security. I was able to define different Region filters in Tableau for different workbooks. This is not the best way to handle security in Tableau, but it’s definitely an option. 

I found a couple of limitations in using parameters in Tableau:

  • A user cannot currently multi-select. The parameter pass through is limited to a single selection. You can vote this idea up on Tableau’s website.
  • The parameter value must be pre-defined. For instance: If there are only four regions defined initially and a new region is introduced, it will not be passed into Tableau.

Implementing in Tableau

Below are the steps a user would take to implement this in Tableau 8.1:

Step 1

Go to the Data Window and select your connection type. In this case, I’m using SQL Server.

Select connection type

Step 2

Input database credentials and custom SQL, then click on the “…” button.

Click on

Step 3

This takes you to another window where you can insert parameters by selecting Insert Parameter.

Insert Parameter

The Report View

The Report View

More About the Author

Shoaib Khan

Principal | Northeast Practice Lead
Passing Database Parameters In Tableau In my first InterWorks blog post, I’ve decided to write about something that I commonly used in other BI platforms. The idea of passing ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072