Tableau Prep Parameters: New in Tableau 2021.4
Parameters finally bring Tableau Prep flows to life, letting you build dynamic, scenario-driven pipelines.
- Parameters in Tableau Prep work anywhere you see the abacus icon, including calculation windows and output steps, and exist throughout the entire flow.
- To filter with a parameter, create a calculated field that returns a Boolean (e.g. segment = segment parameter), then keep only the values that are true.
- Editing a parameter opens a modal window so you can view your data while changing values, and you can click back to previous steps to inspect data without undoing work.
- Output steps let you parameterise both the file name and location, for example appending the segment value to the file name.
- Enabling 'prompt for value at runtime' makes the flow ask for the parameter each time it runs, even on server, which is ideal for scenario modelling.
0:00Hey, Tim here. In Tableau 21.4, Tableau
0:02have added the parameter capability to
0:04Tableau prep. Let me
0:05show you how this works. I'm going to use
0:07the sample flow over here on the bottom
0:08left hand
0:09side. It can work with any flow. So we're
0:11just going to open this up and we're going
0:13to use this
0:14workflow as the default workflow. I'll also
0:17package this workflow and publish it up to
0:19server once we're able to publish prep
0:21flows to server. That will come at some
0:24point next year,
0:24but for now, if you're watching this video
0:27before that feature is available, I'll put
0:29a link to
0:29this flow in their Dropbox folder so you
0:32can try it out. Now, if I go to the top
0:34left here,
0:35you can see there's a new icon here with
0:37this sort of abacus looking sort of element
0:41here. And if I go
0:41in there, I can obviously create a
0:43parameter here. And this is the interface
0:45to create a new
0:46parameter. Now a few things to note before
0:48we get stuck in parameters exist throughout
0:51the entire
0:52prep flow. So you can use this anywhere in
0:54the prep flow, where essentially a
0:56calculation window
0:57can be created, or you can use it as an
0:59item in the output step. So in the output
1:01step,
1:02you can also use this. Essentially, what I
1:04'd say to you though, is don't stick to that
1:07as the way
1:07this works. Essentially, anytime you see
1:09this little abacus icon, know that you can
1:12use a
1:12parameter in that instance. And also if you
1:14click on this abacus icon, anywhere you see
1:17it, you're
1:17normally able to edit the parameter right
1:19there, or change the parameter right there
1:21as well. So
1:23let's go ahead and sort of set things up
1:25and get this working as we should. So let's
1:27go ahead,
1:28I'm going to actually make a segment
1:29parameter. Essentially, this will allow us
1:31to choose a
1:31parameter to then control the data set. I
1:34'll go ahead and I will set a value. So I'll
1:37just say
1:37Home Office. I know this data set fairly
1:40well. So I'll just set that for now. And
1:42now that I've done
1:43that, you'll see that I get this sort of
1:45area up here at the top left hand side,
1:47which allows me
1:48to sort of see where the prep parameter is
1:51actually used over here. You can see it's
1:54not
1:54being used at all. I can edit the parameter
1:56there. And I can of course go ahead and
1:58create another
1:59parameter if I wanted to. I can use
2:00multiple parameters in this particular use
2:02case. What I
2:03will do though, is I'll just go ahead and
2:05go to Clean 2 here, which is where I sort
2:07of think this
2:08is going to be the best place to implement
2:10this. Because of course, at this point, I
2:12actually used
2:13the wrong annotation here. At this point,
2:15this is where you intersect and go off to
2:18these two
2:18outputs. So essentially, I think I can use
2:20this as a pretty good place to intersect
2:22and have the
2:23parameter affect both outputs. Now, the
2:25segment thing I'm trying to match here is
2:27actually over
2:28here. So let's go across. The segment is
2:30just there. So you can see consumer,
2:32corporate and
2:33Home Office are all coming through as
2:35normal. So what I'll do in this clean step
2:37is I'll create a
2:38new calculation to basically check this
2:40parameter. So what I'll do is I'll go up
2:43here to create a
2:44calculated field. Let's go ahead and create
2:46that field. And what I will do is I'll
2:47actually just
2:48type in segment equals segment parameter.
2:51So there's our parameter, it's now working.
2:54And when
2:54I actually let me just name this before I
2:57get confused myself segment, param. And now
3:00that I've
3:01done that, I'm going to hit save. And you
3:03can now see that this parameter has popped
3:06in just there.
3:07Now, if I try and click on this little icon
3:08, unfortunately, here, it doesn't work.
3:10But what you should notice is that this
3:13calculation creates a Boolean outcome. So
3:15you
3:15can see here that it's created this Boolean
3:17outcome called segment param. So what I
3:19need
3:20to do if I want this to actually work, if I
3:22want this to actually filter something is I
3:24can actually
3:25keep just the values that are true in this
3:27particular case. So if I keep any of the
3:29values
3:29that are true, then essentially, what's
3:31actually happening is these two steps are
3:34responsible for
3:35filtering the data to match my parameter,
3:37the first one sets the parameter and tags
3:39the data,
3:40the second one does the filtering. So now
3:42that that's done, if we go across to our
3:45segment column,
3:46we should see that we only have one segment
3:48and that should be the home office segment.
3:50And you
3:50can see that working nicely there. Now, one
3:52of the things we'd like to do is to
3:54obviously set this
3:55parameter so you can change it. So I'm
3:57going to show you a trick over here, if I
3:59just click back
4:00on a previous step, I'll actually get to
4:02see the data as if I was running it from
4:04that point. So
4:05I don't have to undo anything, I can just
4:07click back three steps here, and I actually
4:09get to see
4:10my previous segments, then I'll go back to
4:12the parameter here and edit the parameter,
4:14you notice
4:15this is a modal window. So I can actually
4:17have this open whilst looking at my data, I
4:19think
4:20that's really, really key. It's really nice
4:22touch, I think. So let's go ahead and make
4:24this a list.
4:25Now, of course, it says the current value
4:27is home office. Interestingly, that value
4:30doesn't
4:30pre-populate here. So I think we do have to
4:33type it in again. So let's do that. I would
4:36expect that
4:36to pre-populate if it's already one value,
4:39but all you have to do is click on the next
4:42line,
4:42and then you can type the next one. So
4:46consumer, and then we're going to say
4:49corporate,
4:53and that's pretty much it. And then now
4:54when I go to my drop down, you can see that
4:56it matches up,
4:57and we can actually choose different things
4:59, and that's going to work absolutely fine.
5:00So let's
5:01just set this to consumer, click OK. And
5:04now that we've done that, the parameters
5:06changed, I can
5:07obviously go back to this, I can close this
5:09. And now if I go to my filter parameter, we
5:12'll see that
5:12this is running. And if I go back to my
5:15segment column, we should see that this has
5:19changed,
5:19indeed, to consumer. And again, if we check
5:22up there, you'll see that that's matching.
5:24So that's the sort of first way you can use
5:26parameters as variables throughout your
5:28data set.
5:28And don't forget, of course, you can create
5:30multiple parameters. So maybe you've got
5:32a sales percentage that needs to be applied
5:34to a set of values, you can set that as a
5:36parameter,
5:36then when the salesperson runs the flow,
5:38they can set their own percentages or
5:40values
5:41and have that run through. This is great
5:43for scenario modeling. Maybe you want to
5:44create a
5:45flow that just basically runs a bunch of
5:47scenarios, the user can come in set a bunch
5:50of parameters,
5:51and boom, the flow generates the scenario
5:53for that user as a data set. And they can
5:55start
5:55modeling that or looking at that, or even
5:58having that pipe into a specific data set
6:00specifically
6:01for that person. Imagine if this parameter
6:04also let you, for example, pull in the
6:06server username,
6:07and then you could create or append a row
6:10of data to a data source that had the
6:13scenario for that
6:14person. So they could have a date and time
6:16they run the scenario, and they can have a
6:17filter and
6:18a dashboard. So every time they run this
6:20scenario in prep, it would run, publish up
6:22the data source,
6:23and then when they connect to their work
6:24book, they can go in and sort of look at
6:26this stuff.
6:26It's a really sort of interesting use case,
6:28you can definitely try for this. But
6:30nonetheless,
6:31let's go ahead and show you the next way
6:33you can use parameters inside a Tableau
6:35prep.
6:36If we go to the output, we actually go to
6:38the output step here, you can see that we
6:41have this
6:42parameter icon over here on the bottom left
6:44available to use. And so this is really
6:46interesting,
6:47because of course, this allows us to
6:49parameterize both the name of the file and
6:52the location of the
6:53file. So this is kind of useful as well.
6:55And the thing about the location of the
6:57file is I sort of
6:58wish you were allowed to use not just the
7:00parameter, but the fields in the data
7:02source. This is
7:03something that Altrix has that I really
7:05like, I would love that to be added to this
7:07location
7:08area here. So you know, use a parameter or
7:11use a column in the data set would be a
7:13really nice
7:13option in that exact spot. But let's go
7:16ahead and add something. Let's append the
7:18segment to the
7:19file name. So we'll just do that. I put the
7:22space in the wrong place. There's a little
7:25bit of a
7:25weirdness here where the spacing sort of
7:27doesn't match where the highlighting ends,
7:28but nonetheless,
7:29that's fine. So the file will be called
7:31segment superstore sales. At the moment, it
7:34's a hyperfile.
7:34If I actually go browse, if I actually
7:37cancel and yeah, I think that's right,
7:39actually, if I go to
7:40browse and I just open up this view here,
7:43let's go to my desktop and let's just put
7:45something
7:46in here. This will have to do and then that
7:49will be consumer superstore sales. You see,
7:52it is actually pulling through the
7:54parameter already and hit accept. So that
7:56will work.
7:57And here, what you can actually do is you
7:59can click on this text and change that
8:01parameter
8:02right there. So you can even change that
8:04output right here. And when you hit set,
8:06it obviously runs the data through and
8:08checks everything through again. And you're
8:10pretty much
8:11good to go and it's going to do exactly
8:13what you expect. So that's that. Everything
8:15is set up now.
8:16What I can now do is I can of course run
8:18the flow. And of course, it will ask me to
8:21set the parameter.
8:22And this prompt is actually a tick box that
8:24you can enable. If I go over here to edit
8:27the
8:27parameter, you see prompt for value at
8:29runtime. If you do that and click OK, what
8:31will happen is
8:32when you run the flow, even on server, it
8:34will ask for this option. So you'll see
8:36that it's
8:37prompting me for the value. Set that value,
8:40hit run. And now the flow will run and it
8:43will process
8:44that parameter as it runs through the data
8:46set. Tableau Prep would like to write some
8:48files to
8:48my desktop. It's actually been able to do
8:50that. And there we go. It puts 7,000 rows
8:53or something
8:53through. But I actually know there's
8:55actually there's more than that. If I
8:57create a clean step
8:58just before here, you'll see there's 41,000
9:01. I'm actually looking over here for the row
9:03numbers. So
9:03before the step, it's 41,000. And here
9:07after the step after our prep parameter has
9:10been implemented,
9:11there's only 7,000 rows as you can see here
9:13. So that's pretty much how the parameter
9:16capability
9:16works. There's so many sort of useful
9:18scenarios here. It starts to bring Tableau
9:20Prep to life,
9:21actually, because I think this is a really
9:23nice way of starting to think of ways of
9:25making flows
9:26dynamic and really sort of well integrated
9:28to the ways we work day to day, but also
9:31using them to do
9:32really cool things, but maybe hinting to
9:33another point here, which is Tableau is
9:35really starting
9:36to add features and capabilities into Table
9:39au Prep that we've been asking for for a
9:41long while. And
9:42I'm glad this one's here. So yeah, this is
9:44very similar to Alteryx constants, if that
9:46makes sense.
9:47So constant in Alteryx is a value you can
9:49set and then you can call it inside of the
9:51flow. It's very
9:52similar to that. But in Tableau, we call
9:54those parameters. Thanks for watching this
9:56video. Check
9:57out the other videos on 21.4 release on the
9:59channel and hopefully I'll catch you in the
10:02next
10:02video soon. Thanks for watching.
00:00 - Intro 00:35 - PARAMETER INTERFACE 02:46 - USE THE PARAMETER IN THE FLOW