Ryan Sleeper

This video will show you how to set up a parameter with one of six different data types so that you can pass the control of an analysis from yourself to your end users.

Hi. This is Ryan with Playfair Data TV and in this video I’m going to tell you about another one of the most powerful features in Tableau, which is parameters. I always say that if you can master calculated fields, parameters, and dual axis combination charts you can unlock a lot of flexibility in Tableau that will allow you to do most of the kind of cool tips and tricks and tutorials that you’re going to be learning here at Playfair Data TV.

There are lots and lots of applications of parameters. The best way that I have to introduce this concept is to show you this formula, 2 times the value of X. Parameters are user generated values. So it would allow us to allow the end user to choose what this value of X is. So in this case 2 times X, that X would be the parameter.

We as the dashboard author are able to code what the allowable values for the value of X are. But once we’ve created those limitations, we can pass the control of the value of X over to our end user. So that’s why these are user generated, they get to choose from that point on what the value of X is and whatever number they choose actually becomes part of the formula.

So for this first example, and just to introduce you to this concept, we’re actually going to recreate this little calculator in Tableau, 2 times the value of X. Over here to Tableau Desktop.

There are several ways to create a parameter, just like my favorite way to create a calculated field. My preferred way to create a parameter is to right click into any blank space in the data pane and the second choice down is create parameter. Now click on create parameter.

First thing you have to do is give this a name. I’m going to call this the value of X for this first example. The next thing that you need to do is choose the data type for the parameter. There are six different data types, which you can access by clicking this dropdown. The first is float. That’s any number including decimal places. The second is integer. That’s any whole number. So numbers without a decimal place. String is synonymous with text. Boolean is when there are only two outcomes, it’s either true or false. Date, just like it sounds like. And date and time is date with a time stamp.

Let’s pretend that for our value of X in this fake example with this 2 times X calculator, let’s say that we want to allow the user to eventually choose from values between 2 and 20 in multiples of 2. So these are all going to be whole numbers. So let’s use integer as our data type. Don’t worry about current value for now, that will actually shift automatically when we go add the allowable values. It will actually just default to the first to allowable value. So I’ll skip that for now.

The next thing we need to decide are what those allowable values are going to be. All is the default. This would eventually allow the end user to choose from any integer. That’s way too broad for our particular use case at the moment. List would be an OK choice. This would allow us to list out specific allowable values. But the best choice for what we’re trying to create right now is this third option, range, because it allows us to choose both the start of the range, the end of the range, and the step size, which is Tableau’s word for multiple.

So I’m going to click minimum. Set the minimum to 2. Set the maximum to 20. And the step size will be 2. And that’s it for our parameter. That’s the entire thing. I’m going to click OK. But what you’ll find is parameters do very little on their own, almost nothing in fact. I will show you in a couple of videos what the very little thing they can do on their own but notice when I try to drag value of X onto the view, it’s not even letting me drop it anywhere. It doesn’t really do anything by itself.

Almost in every case, you need to use a parameter integrated with a calculated field, which is going to give Tableau instructions for what to do with that parameter. So we also need to create a calculated field. And I’ll call this my value of X result. And the formula for 2 times X is going to be the aggregation of min. And I’m going to wrap the number 2. And the reason that I’m forcing this aggregation at this stage is if I did not do this, what Tableau would do by default, is take the number 2 times the value of our parameter. But it would do that for every single row.

So in the sample superstore dataset, it would do that 9,994 times, add those all together and the number would be way higher than we expected. So I’m just forcing in aggregation right now to make our formula work here. So min 2, the multiply by operator and then the value of X parameter.

You see the third and final color coding that you’ll see in a calculated field dialog box. We’ve seen blue, which means it’s a function or an aggregation. Orange, means that Tableau recognizes that as a field in our data source. And now we see purple. That’s the color coding for parameters. So if you see purple for a value of X, we know we’ve got the right parameter in this calculation. And in fact, that is the entire calculation. Min 2 times the value of X. My calculation is valid. I’m going to go ahead and click OK. We see a new measure show up here in the measures area of the data pane. And just to show you how this is working, I’m going to drag it to the text marks cart. We see the number 4. Make this just a little bit bigger. But we see the number 4 so we know it’s working.

Remember, I said that it’s going to default to the first allowable value. Our allowable values are 2 to 20 in multiples of 2. So the current value right now is 2. So it’s taking 2 times 2 equals 4.

So I know it’s working properly. But there’s one last step if you want to unlock that flexibility and transfer the control from ourselves to our end users, you have to do one more thing with parameters, which is do what’s called show parameter control. You do that by right clicking on a parameter and clicking show parameter control.

You’ll see a filter- looking dialog box pop up in the top right corner. But that’s actually a parameter control. It’s slightly different. It’s not a filter. It includes the allowable values that we just coded when we created the parameter. So you can see there the current value is 2 but now we can change this and it’s based on the logic that we put into that parameter. So if I click this right arrow, it’s going to go to the next allowable value which is 4, because remember we’re doing 2 to 20 in multiples of 2.

So I click over once it goes to 4. You can see that it did 2 times 4 now equals 8. So we know it’s working. As I click all the way over, it’s going to go to guess what, the highest value in our range, which was 20. So 2 times 20 equals 40.

So we just made a calculator in Tableau using the power of parameters. But what’s important about this, this is just to introduce the concept to you. There’s going to be lots and lots of applications for this. But what’s important is parameters are going to allow us to transfer the control of the analysis from ourselves to our end users. These are user generated values. They’ll be able to choose their own adventure and decide what’s being visualized on the view.

This has been Ryan with Playfair Data TV – thanks for watching!

- The Definitive Guide to Tableau’s Analytics Pane (Part 1) 18:06
- The Definitive Guide to Tableau’s Analytics Pane (Part 2) 23:29
- An Introduction to Dynamic Zone Visibility in Tableau 15:08
- Tableau Prep Builder Essentials 27:14
- Tableau Box Plots, Disaggregating Measures, and Explain Data 14:10
- An Introduction to Tableau Calculated Fields 19:50
- An Introduction to Tableau Parameters 8:53
- How to Use Dynamic Parameters in Tableau 12:55
- How To Use Distance And Buffer Calculations In Tableau 18:23
- How to Use Tableau’s MAKEPOINT and MAKELINE Functions 13:37
- Organizing Dimensions and Measures in Tableau 14:49
- An Introduction to Tableau’s Show Me Feature 7:35
- An Introduction to Sorting in Tableau 4:28
- Four Types of Filters in Tableau 16:16
- Tableau Filters and Order of Operations 9:26
- An Introduction to Tableau Sets 25:05
- An Introduction to Tableau Table Calculations 12:44
- Exercise: Sales and Month over Month Sales 7:25
- 3 Ways to Use Tableau’s Describe Feature 7:41
- 3 Ways to Use Tableau in the Flow 8:22
- How to Create Custom Color Palettes in Tableau 15:55
- Unboxing New Map Styles in Tableau 2019.2 and Mapbox 8:09
- An Introduction to String Calculations in Tableau 10:34
- How to Compare the Last Two Full Date Parts in Tableau 7:35
- An Introduction to the Tableau Pages Shelf 8:08