How to Use Parameters in Tableau Prep to Easily Scale Workflows

Learn how to use parameters in Tableau Prep to eliminate manual work and scale prep workflows, including for reporting on sales data from different years.

In Tableau Prep, you can use parameters to scale your flows to accommodate multiple use cases instead of managing duplicate flows! Introduced with the Tableau Prep 2021.4.1. release, parameters are global placeholder values that you can use to replace constant values in a flow. Easily swap out input or output values that use the same schema when running or scheduling a flow, or use parameters in filters or calculated fields to edit values throughout your flow.

Parameters give you the power to make your prep flows dynamic. In this post, I’ll be walking you through how to use parameters to dynamically filter sales data. Using parameters in this way empowers anyone to easily use your flows without having to understand the technicalities of the flow.

Dynamically filter sales data with Parameters

In this example, we'll be using the Superstore sample data set. Open the data set, then to create a new parameter, click the Parameter icon on the top menu, then click Create Parameter.

The Tableau Prep Builder interface, showing the button along the top menu to Create a Parameter, and text “Define variables that users can specify when running flows on Tableau Prep Builder or on the web.”

Name the parameter “Year of Sale.” Then, set the data type to “Number (whole)” and select “List” as the allowed value type. This will allow whoever runs the flow to choose the parameter value from a preset list of years. Add years 2015 through 2018 to the list, then select “Prompt for value at run time” to require anyone running the flow to choose a parameter value from the list.

Animated GIF of Tableau Prep Builder interface with a multi-step prep flow, showing a user creating and configuring a parameter which would indicate which data to include from a selection of years spanning 2015 to 2018.

After creating the “Year of Sale” parameter, you can apply this parameter to steps in your flow. To see all the places you can apply parameters in a flow, check out our Help documentation Apply Parameters to Your Flow. 

To use the parameter to filter order data by year of sale, add a new filter that checks if the [Year of Sale] field is equal to your parameter value. Notice that the parameter value is highlighted in purple, whereas the field is shown in orange, just like in Tableau Desktop.

An animated GIF of the Tableau Prep Builder interface, showing how a user can use a parameter in a calculation in one of the prep flow steps to filter the order data by year of sale.

When you save this filter, the data is dynamically filtered to only include sales data from the year the parameter is set to.

To keep track of the sales data included in the output, navigate to the Create ‘Superstore Sales.hyper’ output step and use the parameter to replace the end of your file name with the year of sale. It's as simple as clicking the parameters icon and choosing the parameter to apply.

The Tableau Prep Builder interface, showing the user configuring the output step using a parameter to replace the end of the filename with the year of sale—in this example, 2015.

When it’s time to run the flow, you will be prompted to choose a parameter value to run the flow with. Select 2015 from the drop-down, then click “Set” to apply the parameter value and run the flow.

The Tableau Prep Builder interface with a dialog box confirming the flow has finished running, displaying the filename that ends in 2015, which was determined by the parameter used in the prep flow output step.

To run the flow for different data, run the flow again, then when prompted, enter the parameter value “2016.” Notice that the output step updates with the different data depending on the year chosen, and now you have generated two outputs: Superstore Sales from 2015.hyper and Superstore Sales from 2016.hyper.

The Tableau Prep Builder interface with a dialog box confirming the flow has finished running, displaying the filename that ends in 2016, which was determined by the parameter used in the prep flow output step.

In prior releases, you had to manually dig through the flow and tediously change values used throughout or maintain duplicate flows. Furthermore, this required knowledge of the steps in the flow. But, with parameters, using this flow to generate different segments of sales data is as easy as two clicks—helping more people in your organization see and understand their data, faster.

Parameters can also be leveraged to transition your Prep flows from test data to production data. This is useful for when you want to validate that a flow transforms your data properly before overwriting any downstream artifacts. The possibilities are truly endless, and we can’t wait to see the creative ways the Tableau community will use parameters to solve their data problems!

Want to learn more?

For more information, see our Help documentation for Tableau Prep Parameters. Eager to learn more about how to use Tableau Prep? Head over to the Tableau eLearning site and check out the Prep Builder course!