Home  >  Blog  >   Tableau  > 

Tableau Self-Service Ad Hoc Analysis with Parameters

Rating: 5
  
 
7328
  1. Share:
Tableau Articles

The tableau core design encourages discovery. It connects to a wide variety of data sources, and this is further extended through data blending from external sources.

ad hoc can be defined as follows:

“Concerned with a particular end or purpose, formed or used for specific or immediate problems or needs, fashioned from whatever is immediately available.”

Parameters allow those consuming reports to change the context of views with Quick-Filter-like controls. Report builders design parameters into views when the report is created in Tableau Desktop. Parameters create a pathway for non-technical consumers to conduct ad hoc analysis by changing what and how facts and dimensions are displayed—within the boundaries of the designer’s intended usage. Concerns regarding the efficacy of self -service analysis are minimized because the report designer controls what changes are permitted.

Three ways Tableau facilitates ad hoc analysis are:

  • Generating new data with forecasts
  • Designing flexible views using parameters
  • Changing or creating designs in Tableau Server

Interested in mastering Tableau Training? Enroll now for a FREE demo on - "Tableau Online Training".

Tableau Ad Hoc Reporting

What Are Parameters?

Parameters are useful when you want to add interactivity and flexibility to your report, or to experiment with what-if scenarios.

Parameters are dynamic values that can replace constant values in calculations, filters, and reference lines. For example, you may create a calculated field that returns true if Sales is greater than $500,000 and otherwise return false. You can replace the constant value of “500000” in the formula with a parameter. Then, using the parameter control you can dynamically change the threshold in your calculation. Alternatively, you may have a filter to show the top 10 products by profit. You can replace the fixed value “10” in the filter to by a dynamic parameter so you can quickly look at the top 15, 20, and 30 products.

 

It allows users to alter the content of the formula or change a dimension or measure contained in the view. Parameters create a powerful means for changing normally static values into dynamic entities that facilitate ad hoc discovery without the need for changing the design of the view.

How Can Parameters Be Used?

When you work with parameters, consider the following two things that are important in making them useful:

  • They need to be used in calculations.
  • The parameter control needs to be displayed so that viewers can interact with it.

The different ways parameters can be used is limited only by your imagination. Tableau provides some basic parameter controls by building them in different contexts that commonly benefit from the use of a variable. Creative report designers can dream up a myriad of other ways to use this powerful feature by building formula variables that control the facts in view, the dimensions that appear, or the length and granularity of time-series data. Anywhere that you can place a field in Tableau Desktop is a potential repository for parameter control.

  • In Calculations:  Parameters give you a way to dynamically modify values in a calculation. Rather than manually editing the calculation (and all dependent calculations), you can use a parameter. Then when you want to change the value, you open the parameter control, change the value, and all of the calculations that use that parameter are updated.
  • In Filters: Parameters give you a way to dynamically modify values in a TopN filter. Rather than manually setting the number of values you want to show in the filter, you can use a parameter. Then when you want to change the value, you open the parameter control and the filter updates. For example, when creating a filter to show the Top 10 products based on total profit, you may want to use a parameter instead of the fixed “10” value. That way, you can then quickly update the filter to show the top 10, 20, or 30 products.
  • In Reference Lines: Parameters give you a way to dynamically modify a reference line. For example, instead of showing a reference line at a fixed location on the axis, you can reference a parameter. Then you can use the parameter control to move the reference line.

Checkout Tableau Server Tutorials

Basic Parameter Controls

The parameter control is a worksheet card that lets you modify the parameter value. Parameter controls are very similar to filter cards, in that they contain controls that modify the view. You can open parameter controls on worksheets and dashboards and they are included when you save to the web or publish to Tableau Server.

 MindMajix YouTube Channel

Parameter controls first appeared in Tableau several years ago, and they have become a popular feature. To make parameters easier for novice users, Tableau created basic parameter types that are built into typical use cases that benefit from variables. These include:

  • Reference line parameters
  • Bin size parameters (for histograms)
  • Ranking parameters (in value comparison views)

The steps required to add basic parameter controls to a view are provided straightforward so that you know that they exist. Figure 6.9 is a scatter plot that includes basic parameter controls for the vertical and horizontal reference lines.

Checkout Tableau Interview Questions

There are two reference line parameter controls in Figure 6.9 that enable a user to change the location of the reference lines. These variable controls are built into the same dialogue box where standard fixed reference lines are created. To create the parameter, right-click on the axis and select Add Reference Line to expose the reference line dialogue box, and then in the Value box, select the create a new parameter option. Figure 6.10 shows the added reference dialogue box on the left. Selecting the create a parameter option in the value menu exposes the edit parameter window on the right of figure 6.10.

Reference line parameters

Figure 6.9: Reference line parameters

The edit parameter window is where you name and define the parameter. A comment field can be used to hold notes describing the parameter. The properties section is used to define the parameter type. In this example, a floating decimal point value is selected, the display format is a currency, and the parameter is defined for a range of values with a specified increment defined by the step size. Clicking the OK button adds the parameter control. Refer to figure 6.9 again and notice that the parameters allow users to move a slider to change the position of the reference lines.

A second basic parameter type is available for making variable bin sizes in histograms. The view seen in figure 6.11 was initially constructed by selecting the profit field and then picking the histogram chart type from the show my menu. This results in a bin size of five thousand dollars with a very large concentration of items in only two bins.

Creating a reference line parameter

Figure 6.10: Creating a reference line parameter

A basic histogram

Figure 6.11: A basic histogram

 

Right-clicking on the Profit Bin dimension that Shows Me automatically created allows you to select a parameter option for bin size in a manner similar to the last example. By defining a smaller step size for each bin, more granular views of the profit bins can be seen. This is always desirable when viewing histograms. The view seen in Figure 6.12 shows the Profit Bin Parameter set to a smaller value.
The ability to vary bin sizes within histograms can be very useful. As you can see in Figure 6.12, labelling was also added to each bar providing an item count and the total profit or loss expressed in each bin.
Another type of basic parameter is built into charts for creating variable-sized rank lists. Figure 6.13 shows a bar chart comparing sales values by a customer with a year filter. Notice the Parameter Control provides a variable rank list size for the top customers.

Parameterize bins in a histogram

Figure 6.12: Parameterize bins in a histogram

A top rank parameter

Figure 6.13: A top rank parameter

In this example, the parameter control was invoked by right-clicking on the customer name pill on the row shelf, selecting the top filter tab, and defining the parameter range value for the number of customers you want to display in the bar chart. Figure 6.14 shows the complete top 10 filters. This isn’t the only way you can create a flexible rank list, but it is one of the easiest methods.

Quick filter with sales parameter

Figure 6.14: Quick filter with a sales parameter

By placing the sales parameter into a normally static top rank definition dialogue box, it creates a flexible rank list. This isn’t the only way you can create a flexible rank list, but it is one of the easiest methods.

[Related Page - How To Deploy Tableau Server In High Availability Environments?]

Advanced Parameter Controls

More advanced parameter controls can be created that provide greater flexibility. The steps required to create advanced parameters are:

  1. Create parameter control.
  2. Expose the parameter control on the desktop.
  3. Create a calculated value using the parameter control.
  4. Use that calculated value in the view.

Advanced parameters do require a little more effort, but they are easy to build once you become familiar with the process. One of the most common use cases for advanced parameter controls is to permit users to alter the measure being plotted in a view. Figure 6.15 shows a time series chart that is currently displaying sales over time, but with parameter control it allows the end-user to change the measure in view to profit discount, order quantity, or shipping cost.

The Parameter Control contains strings identifying each different measure. Selecting the Parameter Controls’ drop-down menu exposes each measure allowing the user to change the time series chart. Also, notice that the view contains parameterized headings for both the report title and the axis label. Take a look at the step-by-step creation of the Parameter Control for this example.

[Related Page - How To Deploy Tableau Server In Multi-national Entities?]

Create the Parameter Control

You can create the parameter control from the calculation menu or directly from the Data Shelf by right-clicking within the Dimensions shelf and selecting the create parameter menu option. This exposes the parameter menu through which you can enter the options as shown in figure 6.16.

A parameterized time series chart

Figure 6.15: A parameterized time series chart

Defining a string parameter

Figure 6.16: Defining a string parameter

Notice that the parameter is named select measure, which is what appears in the parameter quick filter title. It may seem counter-intuitive that the parameter definition is for a string type versus a number a string is necessary to contain the field names of the measures, that will be enabled in the view. This step only defines the filter box that is exposed on the desktop.

Exposing the parameter control

To make the parameter control available to information consumers, it must be exposed to the worksheet. This is done by pointing at the parameter title that appears on the parameters shelf, right-clicking and selecting the menu options to show parameter control. After this step, the control is available on the desktop to make selections.
Now, I’ve got a new parameter, so expose it.

Exposing the parameter control

Then, it appears here.
It looks like an input, but it does not work at this point.

Exposing the parameter control

Create a calculated value using the parameter control

Making a calculated value that uses the parameter control brings it to life. Figure 6.17 shows the completed calculated value.

Select measure calculated value

Figure 6.17: Select measure calculated value

The calculation uses an if/then/else logical statement to evaluate each string contained in the parameter and then associates the selected string with a specific measurable field. With the completion of this calculated value, only one step remains to activate the parameter within the view.

Use the calculated value in the view

Placing the select measure calculated value on the row shelf activates the parameter. Figure 6.18 shows the complete view.

A parameterized time series chart

Figure 6.18: A parameterized time series chart

Adding the select measure value to the view connects the parameter control to the view and changes what is communicated to the data source when a different measure is selected within the parameter control. The select measure filter now allows users to change the measure to any of the items added in the parameter and the calculated value. Notice that the report title contains the parameter name. Also, the axis label is variable as well. Enabling these refinements requires a couple of extra steps. First, edit the report title and insert the parameter name into the title block. Then, drag the parameter from the parameter shelf to the axis and add the name variable there as well. By editing the axis label and removing the row heading, you can achieve a clean look that flexibly names the report and the axis.

There are many other ways you can use Advanced Parameters but the basic process for all of them follows these four steps. As you gain familiarity with Tableau’s calculation functions, you will think of many different ways to leverage Advanced Parameter Controls.

List Of Tableau Courses:

 Tableau Advanced
 Tableau Server
 Data Visualization and Dashboarding Fundamentals

 

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Tableau TrainingAug 05 to Aug 20
Tableau TrainingAug 08 to Aug 23
Tableau TrainingAug 12 to Aug 27
Tableau TrainingAug 15 to Aug 30
Last updated: 04 August 2023
About Author
Remy Sharp
Saikumar

As a Senior Writer for Mindmajix, Saikumar has a great understanding of today’s data-driven environment, which includes key aspects such as Business Intelligence and data management. He manages the task of creating great content in the areas of Programming, Microsoft Power BI, Tableau, Oracle BI, Cognos, and Alteryx. Connect with him on LinkedIn and Twitter.

Recommended Courses

1 /15