Was this page helpful?
Yes No

Set Actions

Use set actions to let your audience interact directly with your viz or dashboards to control aspects of their analysis. When someone selects marks in a viz, set actions can change the values in a set. For examples on how set actions can be used, see Examples of set actions.

Watch a video: To see related concepts demonstrated in Tableau, watch Set Actions, a 7-minute free training video. Use your tableau.com account to sign in.


Image showing dashboard that using set actions. A user selects a mark in one part of the dashboard to control the values that display in another part of the dashboard.

Set actions take an existing set and update the values contained in that set based on a user’s action in the viz. You can define the set action to include:

  • the source sheet or sheets it applies to.
  • the user behavior that runs the action (hover, select, or menu).
  • the target set (the data source and set to be used).
  • what happens when the selection is cleared.

To change or affect a visualization, the set referenced in the action must be used somehow in the visualization. You can do this in different ways, such as using the set in a calculated field that you then use to build the viz, or by placing the set in the view or on a Marks card property.

Set actions must be created in Tableau Desktop to be available for use in Tableau Online and Tableau Server.

General steps for set actions

  1. Create one or more sets. The sets you create will be associated with the data source that is currently selected. For details on creating sets, see Create Sets.

  2. Create a set action that uses one of the sets you created. You can create multiple set actions for different purposes.

  3. Depending on the behavior you want to make available to users for their analysis, you might want to create a calculated field that uses the set. For details on creating calculated fields, see Create a calculated field.

  4. Build a visualization that uses a set referenced by a set action. For example, if you create a calculated field that uses the set, build the view using that calculated field. Or, drag the set to Color in the Marks card.

  5. Test the set action and adjust its settings as needed to get the behavior you want your audience to experience.

Create a set action

  1. In a worksheet, select Worksheet >Actions. In a dashboard, select Dashboard >Actions.

  2. In the Actions dialog box, click Add Action and then select Change Set Values.

    Actions dialog box with Add Action button clicked and Change Set Values action selected to create a set action.

  3. In the Add/Edit Set Action dialog box, specify a meaningful name for the action.

  4. Select a source sheet or data source. The current sheet is selected by default. If you select a data source or dashboard you can select individual sheets within it.

    Add or Edit Set Action dialog box showing different settings for set actions.

  5. Select how users will run the action.

    • Hover - Runs when a user hovers the mouse cursor over a mark in the view.

    • Select - Runs when a user clicks a mark in the view. This option works well for set actions.

    • Menu - Runs when a user right-clicks (control-clicks on Mac) a selected mark in the view, then selects an option on the context menu.

  6. Specify the target set. First, select the data source, and then select the set.

    The sets available in the Target Set lists are determined by the data source that you select and the sets that you have created in the workbook that are associated with that data source.

    Add or Edit Set Action dialog box showing different settings for set actions.

    In this example, the target set is using World Indicators as the data source and Country set as the set.

  7. Specify what happens when the selection is cleared in the view:

    • Keep set values - Current values in the set remain in the set.

    • Add all values to set - Adds all possible values to the set.

    • Remove all values from set - Removes previously selected values from the set.

  8. Click OK to save your changes and return to the view.

  9. Test the set action by interacting with the visualization. Tweak some of the settings for the action to adjust the selection behavior as needed.

Examples of set actions

The following examples show just a few of the ways you can use set actions. To follow along, you will need to be familiar with creating and using sets and calculated fields. For details, see Create Sets and Create a calculated field.

Learn more: To see other in-depth examples of how you can use set actions demonstrated in Tableau, see 8 ways to bring powerful new comparisons to viz audiences with set actions in the Tableau Blog. Also see Sets Appeal, a 1-hour free video presentation.

Proportional brushing

A classic use case for set actions is proportional brushing, described in How to do proportional highlighting with set actions on the Tableau blog and Tableau Set Actions from The Information Lab blog (along with other examples).

Set action example showing proportional brushing in a dashboard. Clicking a bar in view shows the proportion of values in the other bar chart.

Closed Proportional brushing example details Proportional brushing example details

This example uses the Sample - Superstore data source. This set action changes the color of existing marks in the view based on the proportion of the mark that is in or out of the set.

  1. Connect to Sample -Superstore data in Tableau Desktop.

  2. In a new sheet, drag Sales measure to Columns, drag Segment dimension to Rows.

    Fields that are used to create a Sales by Segment visualization.

  3. In another blank sheet, drag Sales measure to Columns, drag Sub-Category dimension to Rows.

    Fields that are used to create a Sales by Subcategory visualization.

  4. Create a set for the Segment dimension named Segment Set.

    Right-click Segment field, select Create, and then select Set.

  5. In the sheet that shows Sales by Sub-Category, drag Segment Set onto Color in the Marks card.

    Segment set placed on the Color property in the Marks card.

  6. Create a new dashboard. Drag both sheets into the dashboard.

    On the Dashboard menu, select Actions. Click Add Action, and then select Change Set Values.

    Open the Actions dialog box from the Dashboards menu.

  7. Configure the action using the same settings as shown in the image below.

    Name set action Proportional Brushing, select the dashboard and both sheets, Run action on Select, set Target Set to Superstore database and Segment set, set clear selection to Add all values to set.

  8. Click OK to save your changes and return to the view.

  9. Test the set action by clicking the marks for each segment.

 

Asymmetric drill down

Set actions can also be used across multiple sets for more complex interactions. If a data set has hierarchical information, such as Category, Sub-Category, and Manufacturer, normally drilling down the hierarchy expands all values at a given level. However, you can use set actions for asymmetric drill down, opening only the next hierarchy level for the selected value.

Example shows clicking a category header to expand related subcategories, and click a subcategory header to expand related manufacturers.

ClosedAsymmetric drill down example details Asymmetric drill down example details

This example uses the Global Superstore data source.

Set actions are used here in conjunction with two calculated fields to create an asymmetric drill down experience.

  1. Create a set for the Category field named Category set.

    Choose any category to be a member of that set. The membership is temporary and will be overwritten by the set action.

  2. Create a calculated field named Asymmetric Sub-Category.

    Right-click in the Data pane, and then select Create Calculated Field.

    Type the following calculation:

    IF [Category set] THEN [Sub-Category] ELSE [Category] END

    Calcuation window showing calculation.

    If the category of the mark or marks in the view is in the Category set, the calculation will return the Sub-categories for that Category. Otherwise, it will return the Category again.

    The set isn't in use in the view yet and has no action associated with it, so it is static for the moment.

  3. Create a second set for the new Asymmetric Sub-Category field named Sub-Categories set. Choose any Sub-Category to be a member of that set. The membership is temporary and will be overwritten by the set action.

  4. Create a calculated field named Asymmetric Manufacturer.

    Right-click in the Data pane, and then select Create Calculated Field.

    Type the following calculation:

    IF [Sub-Categories set] THEN [Manufacturer] ELSE "" END

    Calcuation window showing calculation.

    If the sub-category of the mark(s) in the view is in the Sub-Categories set, the calculation returns the Manufacturer for that Sub-category. Otherwise, it returns a null value and does nothing.

    The set isn't in use in the view yet and has no action associated with it, so it is static for the moment.

    Note: Manufacturer doesn't exist as a field in the Global Superstore data set. For this example, a calculated field was created to pull the first word from the Product Name field. In some instances, this is not the manufacturer. Any oddities seen in the manufacturer results are likely due to this and not an error in the set actions.

  5. Build the view by dragging the Category, Asymmetric Sub-Category, and Asymmetric Manufacturer fields to Rows (in that order). Drag Sales to Columns.

    Category, Asymmetric Sub-Category, and Asymmetric Manufacturer fields on Rows and Sales field to Columns.

  6. Create the first set action: Drilldown to Asymmetric Sub-Category.

    On the Worksheet menu, select Actions. Click Add Action, and then select Change Set Values.

    Name the action Drilldown to Asymmetric Sub-Category.

    Add Set Action dialog box with settings.

    Select the following options:

    • Source Sheets: Make sure the only the current sheet is selected.
    • Run action on: Choose Select. This will make the action apply when the user selects a mark or marks in the view.
    • Target Set: Select the current data source from the first drop-down list and the Category set from the second drop-down list.
    • Clearing the selection: Select Remove all values from set.

    Click OK.

  7. Create the second set action: Drilldown to Asymmetric Manufacturer.

    On the Worksheet menu, select Actions. Click Add Action, and then select Change Set Values.

    Name the action Drilldown to Asymmetric Manufacturer.

    Add Set Action dialog box with settings.

    Select the following options:

    • Source Sheets: Make sure the only the current sheet is selected.
    • Run action on: Choose Select. This will make the action apply when the user selects a mark or marks in the view.
    • Target Set: Select the current data source from the first drop-down list and the Sub-Categories set from the second drop-down list.
    • Clearing the selection: Select Remove all values from set.
  8. Click OK to save your changes.

  9. Test the set action.

    When you click on a header or mark in the view, it will expand out to the next level. For example, clicking a sub-category bar will expand just that sub-category to show its component manufacturers. Clicking a category bar will expand its sub-categories.

Color scaling

Color values in a viz often can be distorted by outliers. When one country has a significantly higher value than other countries, the nuance of differences between those non-extreme values can be lost.

A set action can update the values in a Country set based on the selection in the viz. That set is then used in a calculated field that computes the value of the relevant measure for only countries in that set, and that calculated field is placed on color. Now, when countries are selected in the map, the color palette is based only on those countries, showing greater visual differences between those values.

Example showing selection of subset of marks in world map. Color value range changes depending on the selection.

ClosedColor scaling example details Color scaling example details

This example uses the Global Superstore data source.

  1. Create a set on the Country field named Country set. Chose any country to be a member of the set. The membership is temporary and will be overwritten by the set action.

  2. Create a calculated field named Country Shipping Cost.

    Right-click in the Data pane, and then select Create Calculated Field.

    Type the following calculation:

    IF [Country set] THEN ([Shipping Cost]) END

    Calculations window showing calculation.

    If the country of the mark(s) in the view is in the Country set, the calculation returns the Shipping Cost. Otherwise, it does nothing.

    The calculated field ties the set into the view.

  3. Double-click the Country dimension to automatically create a map.

  4. Drag Country Shipping Cost to Color in the Marks card. The map should automatically update to a filled map.

    World map with Country Shipping Cost on color.

  5. Create the set action: Country color scaling.

    On the Worksheet menu, select Actions. Click Add Action, and then select Change Set Values.

    Name the action Country color scaling.

    Edit Set Action dialog box.

    Select the following options:

    • Source Sheets: Select only the current sheet.
    • Run action on: Choose Select. This will make the action apply when the user selects a mark or marks in the view.
    • Target Set: Select the current data source from the first drop-down list and the Category set from the second drop-down list.
    • Clearing the selection: Select Add all values to set.
  6. Click OK to save your changes.

  7. Test the set action.

    When you select a mark or group of marks in the view, the color palette responds by representing the values for those marks, not the entire data set.

 

Relative dates

This dashboard example contains multiple relative date calculations. Based on a target date, the dashboard displays the difference from the previous day, the percent change from the same month in the previous year, the Year to Date sales for the current year, and Year to Date sales for the previous year.

The set action in this dashboard updates the target date and relevant date calculations in response to a user clicking a mark on a timeline.

Example that shows how clicking a timeline date updates other parts of the dashboard.

ClosedRelative date example details Relative date example details

This example uses the Global Superstore data source.

The set action in this example is applied to the Timeline sheet in the dashboard, and drives the behavior of the dashboard. When a user selects a mark in the timeline view, the set action updates the Selected Date set with a single date value.

In this example:

  • A Selected Date set is built on the Order Date field.

  • An Update Target Date set action updates the Selected Date set so the date value for the mark selected in the view is the only value in the set.

  • A Target Date calculated field captures the date value from the Selected Date set, and that calculated field is referenced by other relative date calculations in the viz.

  • Each sheet in the dashboard uses calculated fields to update its displayed values.

Note: Because this example is more complex, the description below gives a summary of the major steps and settings involved rather than specific details.

Timeline sheet settings

Sales is on Rows. A calculated field named Target Date is placed on Detail to make it available to the reference line.

Sales field placed on Rows shelf. Target Date calculated field place on Detail.

Order Date is on Columns as Exact Date.

Order Date placed on Columns self. Right-click Order Date field in the view to set the date type to Exact Date.

The reference line is applied to the Order Date field and is set to be the Minimum of Target Date.

Reference line applied to Order Date field. Reference line is set to be the minimum of Target Date.

A set action is applied to this sheet that updates the Selected Date set based on what mark is selected in the view.

Set action that acts on Selected Date set based on the selected mark.