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, ...

Get Use Tableau Parameters to Create Dynamic SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.