Tableau Parameters: Mastering the Most Useful Parameters Fast

Tableau Parameters are some of the most flexible, and frankly, most awesome features of Tableau.  A Tableau parameter allows you or your end-user to change the content that appears in worksheets and dashboards.  This can be something simple like a value or something much more advanced.  Here we’ll cover several of the most commonly used examples of Tableau parameters. 

Pre-defined Lists for Faster Filtering 

As a general rule, Tableau parameters run faster in Tableau than Quick Filters.  Every time a Quick Filter runs it pings your data source, which can slow you down.  Tableau Parameters are retained in memory.  So, if you have a list of values you want to use as a filter that you know isn’t going to change, or will change infrequently, use a Tableau parameter instead.  

For example, let’s say you have regions: North, South, East, West, MidWest, and Pacific Rim.  You know that these are always the regions.  You have a Dimension in your data called Region.  You could use the Region field as a Quick Filter.  However, you could retype these values in a Tableau Parameter and use that as a filter instead and gain processing speed.  The caveat here is, if your Dimension is going to change frequently, say for example, Customer Name, you don’t want to be reupdating your Tableau Parameter all the time.  Quick Filters are dynamic, Tableau Parameters are static.  It’s a limitation of Tableau. 

To create the Tableau parameter: 

  1. Right click anywhere in the data pane along the left and choose Create > Tableau Parameter.   
  1. Give the Tableau Parameter a title.  
  1. Change the Data Type to “String.”   
  1. Change the radio button at the bottom for Allowable Values to “List.” 
  1. Type in the values down below. 
Tableau Parameters
  1. Choose ok. 
  1. Right click again and choose Create > Calculated Field.  Name your Tableau parameter calculation (i.e. Region Filter). 
  1. Drag the newly created Tableau parameter into the calculation window where your cursor is so that it reads [Region Parameter] = [Region]  (or whatever names you’ve chosen). 
Parameters in Tableau
  1. Choose ok and then drag your Tableau calculation parameter to the Filters shelf.  Set the filter to show only True. 

Tableau Top N Parameter 

Filtering and sorting are two of the most used tools in any analyst’s toolkit.  Often you want to see just the top 10 of something.  But what if your audience has different needs?  Maybe someone wants to see the top 20 or the bottom 20.  A Tableau parameter allows you to do this. 

  1. Let’s look at top Products by Order Quantity.  Drag Product Name to rows and Order Quantity to columns. 
  1. Now drag Product Name to the filter shelf.   
  1. A filter box will appear with a number of tabs along the top.  Each of those allows you flexibility in how you filter.  For now, go to the Top tab. 
  1. Choose “By Field.” 
  1. To create the Tableau parameter, select “Create a new parameter” in the drop down where it says 10,  
Create Parameter Tableau
  1. Name your Tableau parameter “Top N Products.” 
  1. Set your min and max values in the Tableau parameter – in this case let’s do 10 and 50.  Set the step size to 5 (this is by how much each change increments upwards). 
Tableau Top N Parameters
  1. Click ok and a small box with a slider will appear on the right of the Tableau parameter box. Use the slider to adjust the Tableau parameter. Then, explore how the Tableau parameter changes the viz. 

Reference Line Parameter 

As mentioned previously, the reference lines Tableau parameter can be a very beneficial way to highlight key information, show thresholds and targets, highlight outliers, etc.  Parameterizing these in Tableau allows your end-user to see the data in relation to the targets or thresholds or reference points they want to see. 

Parameter in Tableau
  1. On the same chart we just created using Tableau Parameters, right click on the axis and choose Add a Reference Line. 
  1. To create the Tableau parameter, click the drop down arrow (where it says Sum(Order Quantity) and change that to “Create a New Parameter” in the Value section in the middle.
  1. Name this Tableau parameter “Number of Orders > N” 
  1. Make it a range of values in the Allowable Values section.   
  1. Set the min to 50 and the max to 700 on the Tableau Parameter 
  1. Set the step size of the Tableau parameter to 20. 
  1. Now play with the slider and see how many fall above the line. 
Tableau Parameter Filter
Parameters Tutorial in Tableau

Swapping Dimensions or Measures in a View 

We now get into a more advanced use of Tableau parameters, but one that is extremely useful.  Say you have a well-formatted, insightful chart. Rather than recreate the same chart for six different metrics, you’d like your user to be able to see whatever they want to see with just 1 click. 

  1. Create a new worksheet at the bottom. 
  1. Right click in the data pane and create a new Tableau parameter. 
  1. Name this Tableau parameter as “Choose Dimension.” 
  1. Change the Data Type on the Tableau Parameter to a String. 
  1. Set the Allowable Values to a List. 
  1. Edit the Tableau parameter. In the window down below, type the following field names, one per line. 
    • Customer Segment 
    • Marketing Channel 
    • Product Category 
    • Product Sub-Category 
    • Product Name 
How to Create a Parameter in Tableau
  1. Click ok. 
  1. Now right click and create a calculated field using a Case/When statement.  Name it Choose Dimension Calc. 
Case [Choose Dimension] 
When ‘Customer Segment’ then [Customer Segment] 
WHEN ‘Marketing Channel’ THEN [Marketing Channel] 
WHEN ‘Product Category’ THEN [Product Category] 
WHEN ‘Product Sub-category’ THEN [Product Sub-Category] 
WHEN ‘Product Name’ THEN [Product Name] 
END 
  • Note the following:  
    • Capitalization doesn’t matter in the function portions in blue. 
    • You need the apostrophe marks around the actual text shown in your Tableau parameter 
    • You can drag in your orange Dimension fields from the data pane. 
    • You must close the Tableau parameter with an end statement. 
    • If you are used to writing SQL, the case statement is obviously something you are familiar with.  Note that Case syntax in Tableau is slightly different.  It’s Case [Field] then your When conditions. 
Using Parameters in Tableau
  1. Bring this calculation to the Rows shelf and Number of Records to the Columns shelf. 
  1. Right click on the Tableau parameter you created at the bottom of the data pane and choose “Show Parameter Control.” 
  1. Click the Sort Descending icon on the Tableau parameter. 
  1. Now select different drop downs from the Choose Dimension parameter and see how the chart changes. 

You can use this Tableau parameter technique to swap out dimensions, swap out measures, swap out headers on your axes in a chart, and change the title.  This gives you almost infinite flexibility in how you present and share information. 

How to Set Parameters in Tableau

Swapping Dimensions or Measures Examples

To illustrate just one more example of this Tableau parameter technique: 

  1. Double click the title and name it “Orders by .”  (Be sure to include the space after “by”). 
  1. Then click the Insert drop down menu at the right of the Tableau parameter menu. 
  1. Select your [Parameters.Choose Dimension] field.  Click ok 
  1. Now change the Tableau parameter values and see how it changes your title. 
Tableau Parameters

Tableau Parameters What If Analysis 

Allowing users to perform a “what if” analysis can be an extremely effective way to motivate action.  For example, if you highlight your company’s current state, and give them the ability to change some assumptions and values and see where you could end up, people want to make that a reality. 

Let’s say we wanted to see the average price per Ship Mode.  

  1. On a new tab, drag Sales and Order Quantity to the columns shelf.  They’ll both default to Sum, which is what we want. 
  1. Drag Ship Mode to rows. 
  1. Create a calculated field showing sum([Sales])/sum([Order Quantity]). 
  1. Name this Avg. Price and drag it to the right of the other two pills on the columns shelf. 
  1. Turn on labels for each. 
Parameters Tableau
  1. Now click on the pill for Avg. Price and then click the Sort Desc icon. 
  1. Now create a new Tableau parameter entitled What If Price. 
  1. Set the Data Type to Float.  Set the Min value to 0 and the Step Size to 10.  Uncheck the Max value (this will allow your end user to set the number to whatever they want). 
  1. Next, create a new calculated field and name this What If Revenue. 
  1. Type in the following formula: ([Avg. Price]+[What If Price])*SUM([Order Quantity]) (There are duplicate order IDs in the data). 
  • This formula takes the average price and allows your end user to add an amount to the average price.  Then you multiply the new price by the number of instances of that to determine the overall impact on revenue. 
Tableau Create Parameters
  1. Add the What If Revenue pill to the right of the other pills on the columns shelf. 
  • If the “What If” Tableau parameter box does not appear, go down to the Parameters section at the bottom left, find the Tableau parameter, right click it and choose “Show Parameter Control.” 
Tableau Parameters What If Analysis
  1. Finally, create a new calculation entitled Forecasted Revenue Increase using the following formula:  [What If Revenue]-SUM([Sales]).  Drag that to the columns shelf as well. 
  1. Drag the same calculation to the color shelf on the segment under the marks card that is labeled AGG(What If…). 
  • This will convert all the other bars to a gray color and provide a default blue sequential color scheme on the last bars in the chart. 
Tableau What If Analysis Parameter
  1. Click the down arrow on the legend icon at the top right.  Choose Edit Colors. 
  1. Change the color to Orange-Blue Light Diverging. Set it to Stepped Color with 4 steps, and check the Reversed box. 
  1. Now, look at the change in the forecasted revenue. 
What If Analysis in Tableau
Shape

Finance wants to be able to have more control of how they look at the numbers.  We’ll use Tableau parameters to give them this flexibility. 

Practicing How to Use Tableau Parameters

  1. Go to the tab labeled “Best Customers.” 
  1. If you don’t have it, bring Customer Name to Rows and Profit to Columns.  Color by Profit.  Sort Desc. 
  1. Right click on the Measures pane and Create a Tableau Parameter. 
  1. Title your Tableau Parameter “Top N Most Profitable Customers.” 
  1. Set the Tableau parameter’s Data Type to Integer and set the Allowable Values to Range. 
  1. Set the range from 1 to 50, with a step size of 2.  Click ok. 
  1. Now right click on the Tableau parameters at the bottom left and choose “Show Parameter Control.” 
  1. Create a new calculated field entitled “Index.”  In the formula window, type Index().   
  • We didn’t cover this much above but it works very similarly to the Rank calculations.  Since we’ve already got customers sorted by profit in descending order, bringing out the Index calc will show the rank of each customer with 1 being the most profitable. 
  1. Bring this out to the Rows shelf.  The Tableau parameterS will automatically start as continuous and come after Customer Name. 
  1. Click on the down arrow and set it to Discrete.  Now move it before Customer Name. 
  1. Create a new calculated field entitled “Top Customers.”  Type the following formula: 

[Index]<=[Top N Most Profitable Customers] 

  • This Tableau parameter will find the rank and show everyone before that and up to it. 
  • You can find the fields in your Tableau parameter date pane and just drag them into the calculation editor. 
  1. Bring this new Top Customers calculation to the Filter shelf.  Set it to True. 
  1. If you don’t want to see the actual customer rank, click on the down arrow on that pill and uncheck “Show Header.” 
  1. Move the slider around to see how the view changes. 

If you have the Customer Profitability Overview Dashboard from Day 2, go to that dashboard and continue on for the rest of the steps in this exercise. If you do not have that dashboard, proceed to the next section of the book as you will need it for steps 15-20. However, no further practice exercises will depend on this dashboard, so if you do not have it, it will not halt your progress.  

  1. Set your dashboard title to left aligned. 
  1. Move the Customer Segment quick filter over towards the middle. 
  1. Click on your Best Customers chart so that it is selected. 
  1. Now go up to the Analysis menu at the top, Tableau Parameters > Top N Most… 
  1. Set the Tableau Parameter to Floating by clicking the down arrow and position it next to the Customer Segment quick filter. 
  1. Now click the down arrow on the Tableau parameter and change it from a Slider to a Type in box.  Determine which of the two types you like most and set it to that. 

There is more to learn about Tableau Parameters and the best ways you can utilize them for your data views and analysis. If improvement in Tableau usage and data analysis is what you are looking for, check out our Tableau Training that is available for both individuals and corporations.

Shape