Preparing data is hard—and repetitive work can be unnecessary and downright painful. Let’s say you need to clean multiple data sets that have similar patterns. You don’t want to create the same calculated field over and over again for every new data set.
In this blog post, I’ll use an example to show you how to reuse flows in Tableau Prep Builder to cut down repeatable tasks and make your data prep more efficient.
Use case for reusing flows: Preparing survey data
See the below example coming from the census, showing American’s debt from 2003 to 2018. This is a type of census data set, with each sheet containing the same format.
Each column is broken out by year and rows are broken out by state code. The table contains debt amount for each state.
Four sheets contain the debt amount by category of the debt (colored in orange) and the other four sheets contain the percent of population that goes into delinquency by the debt category (colored in blue).
This means there are two sets of measures in this data set, one for average debt amount and another one for the delinquency percent. In this case, you would need to combine these data sets to allow users to compare and contrast between the debt amount and the delinquency percentage.
The diagram below explains the flow that you’d need to go through to produce one set of data. I need to repeat the same process twice to produce the two sets of data then combine the two by joining them.
Copy and paste parts of your flow
In our example, I need to repeat the complex flow, consisting of union and pivot, twice over before joining the resulting data set. Tableau Prep Builder has a better way to handle this potential repetition.
Select multiple nodes and copy the selection to the clipboard and then select “paste.”
The part of the flow contained a pivot. I used wildcard pivot so that the copy and paste works without additional tweaks to each pivot node.
Reuse flow steps across different Tableau Prep flows
There are cases when you want to reuse part of your flow between different Tableau Prep flows.
- You have a survey data set that has the same format and the same cleaning flow.
- You have a complicated calculation that you need to use over and over.
- You want to combine multiple flows together into a single flow to manage at once.
We call these small snippets of flow “Saved Steps," which you can save and reuse. You can save parts of your flow as a local file or on your Tableau Server and then load them into your own flow to reuse.
Using the same example, let’s say that I want to compare the average debt amount to the state’s average income level. To do this, I’ll need to expand the data set to include the average income data that I prepared in a different flow. I do this by pulling up the part of the flow from a different data set and merging it with the existing flow (shown below).