Search

What is a Parameter in Tableau


A parameter is simply a user input into Tableau to make a change to something in the view. In Tableau you can choose float data types integer data type string Boolean date date time and there's a couple other adjustments that you can make just to show you what a parameter is. If I wanted to only show sales above a certain amount I could create a calculated field and reference my new parameter gray calculated field by clicking the drop down 100 data pane create calculated field. I can then drag sales from The View into my calculator field if sales is greater than or equal to my integer value. Two use cases for parameters in tableau. String parameters & Integer Parameters.


What is a parameter in tableau I’m going to take the next five ten minutes to give you some examples of what parameters are in Tableau and what they can be used for let’s go take a look in Tableau desktop

Now that we’re in Tableau desktop let’s take a look at parameters how to create them and what they are I’m gonna open a new sheet here for a blank canvas

The drop down here to create a parameter click the drop down in the data Pane and create new parameter will give you kind of a blank slate I have a couple options here I can choose float data types integer data type string Boolean date date time and there’s a couple other adjustments that you can make just to show you what a parameter is I’m going to start with an integer the current value is going to be 1. I’m just going to call it integer value

Click ok

And you’ll see that my new parameter called integer value shows up on the parameters pane I’m just going to click the drop down on that integer value parameter and click show parameter and it’s very simplest a parameter is simply a user input into Tableau to make a change to Something in the view I can now change this this integer value from 1 to 2 or 22 or 25 um nothing happens parameters in Tableau don’t do anything and until you connect them via a calculated field I’m going to start with we’re going to do two examples one example with a string parameter and one example with an integer parameter the integer value is already there so let’s start with that I’m going to grab a field here and grab sales

I’m going to drag it onto rows

Measures always aggregate when you the direct drug into the canvas so I’m going to change it from some just to the point here I’m going to change it to a dimension and change it to discrete so now I have every possible sales value in the data set

Goes from 0.44 all the way up to values of 22 000. Now let’s say I wanted to filter this in some way I wanted only to show sales above a certain amount I could create a calculated field and reference my new parameter gray calculated field by clicking the drop down 100 data pane create calculated field and I’m just going to Simply write a yes or no a true or false statement that tests if sales and I can just drag sales from The View into my calculator field if sales is greater than or equal to my integer value

You can see sales you’ve probably used calculated Fields before sales is orange so all of your Fields your columns are going to show up as orange parameters will show up as purple so I’m just doing a true or false I’m just going to call it sales is greater than uh parameter

Again true or false yes or no I’m going to click apply

I’m just going to drag that new field that I created onto color

It gave me blue squares for any value that is lower than 25. The orange squares for any value that is over 25. This is of course adjustable because that’s the point of a parameter that you want the user to be able to change something about the view I could change this to maybe 100

And you’ll see that anything below 100 is now blue anything above 100 is orange of course I could use this as a filter as well and I can keep only True Values

Why okay and you’ll see that my whole view was filtered dynamically based on the parameter selector to show only values over 100. All right let’s do a second example with string values instead of integer values

A calculated field by searching for region to create a string parameter based on the region field you remember last time I just clicked the drop down and selected create parameter this is going to be a second way to be able to create a parameter you click on region click the drop down

So that create parameter

This time my list of values have been filled in for me I didn’t have to put a list in here myself Tableau just put every unique region as a value in the parameter and just call it region parameter two we’ve got East Central South and West click ok let me see my region parameter showed up down here click the drop down click show parameter

And I have my my region parameter on the right hand side here remember parameters don’t do anything and they’re connected to the view so if I change this from east to north to south nothing happens let me show you a pretty cool use case on using string parameters a little different than the integer example or create a calculated field

And I’m just going to call it chosen region sales

I’m going to write a statement just an if statement that says if region and remember if it’s orange that means you are referencing a column if it’s purple you are referencing a parameter so if region equals region parameter

Then give me zeros and if statements always end with an end

I’ll click apply

And okay so if I just move that region sales field that I just created onto text I have 391 000. The chains region parameter to North I get 501. So I move it to west or south you know I get the the corresponding value that’s one way that you can use a parameter to adjust what’s happening on a view as a secondary example on this uh string parameter section I can divide that I can adjust this and I can divide my sum of the chosen region sales divided by just sum of sales

And that if you’re following along is just percent of total

Click click apply and okay and if I grab that percent of total

Calculation put it on text as well and make this a percent format as a percentage I can see that the south region has 391 000 sales which represents 17 of the whole and of course if I keep changing that I get different values so you know in in short parameters are used as a user entry to change something on The View

2 views0 comments