Skip to Main Content
Use Tableau Parameters to Create Dynamic SQL
shortcut

Use Tableau Parameters to Create Dynamic SQL

by Christopher Gardner
May 2024
5 pages
9m
English
O'Reilly Media, Inc.
Content preview from Use Tableau Parameters to Create Dynamic SQL

Use Tableau Parameters to Create Dynamic SQL

Large datasets are challenging to deal with. In Tableau, there are techniques that you can use to limit the data pull and simplify your work. For example, extracts pull the data from its source location and create an optimized data format that is faster for Tableau to pull, manipulate, and analyze. There are also tools like data-side filters, aggregation, pivot tables and more. One of the best tools to utilize when streamlining data pulls is custom SQL.

Any database that allows SQL to be written against it has an option for customized SQL within the data connection screen in Tableau. Writing custom SQL allows the user to not only limit what rows are pulled via a WHERE clause, but also narrows the number of columns to only include those necessary to generate the visualizations. Narrowing the number of columns and decreasing the number of rows are two excellent ways to increase the speed of data pulls.

Tableau takes this narrowing of the data one step further. Tableau allows you to insert parameters from your workbook into the SQL. This takes the user’s input and limit’s the SQL based on the result. So, how can you use this to your advantage? How can you populate a parameter value to transfer to your SQL pull? Let’s look at an example.

Imagine you are the dashboard developer for a large retail organization. Your dashboards pull aggregate data about sales, profit, shipping, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Fuzzy Data Matching with SQL

Fuzzy Data Matching with SQL

Jim Lehmer

Publisher Resources

ISBN: 9781098169886