Create Sets
You can use sets to compare and ask questions about a subset of data. Sets are custom fields that define a subset of data based on some conditions.
Watch a video: To see related concepts demonstrated in Tableau, watch the free training videos Creating Sets (6:54 minutes) and Working with Sets (4 minutes). Use your tableau.com account to sign in.
You can make sets more dynamic and interactive by using them in Set Actions. Set actions let your audience interact directly with a viz or dashboard to control aspects of their analysis. When someone selects marks in the view, set actions can change the values in a set.
In addition to a Set Action, you can also allow users to change the membership of a set by using a filter-like interface known as a Set Control, which makes it easy for you to designate inputs into calculations that drive interactive analysis. For details, see Show a set control in the view.
There are two types of sets: dynamic sets and fixed sets. The members of a dynamic set change when the underlying data changes. Dynamic sets can only be based on a single dimension.
To create a dynamic set:
In the Data pane, right-click a dimension and select Create > Set.
In the Create Set dialog box, configure your set. You can configure your set using the following tabs:
General: Use the General tab to select one or more values that will be considered when computing the set.
You can alternatively select the Use all option to always consider all members even when new members are added or removed.
Condition: Use the Condition tab to define rules that determine which members to include in the set.
For example, you might specify a condition that is based on total sales that only includes products with sales over $100,000.
Note: Set conditions work the same as filter conditions. See Filter Data from Your Views to learn more.
Top: Use the Top tab to define limits on what members to include in the set.
For example, you might specify a limit that is based on total sales that only includes the top 5 products based on their sales.
Note: Set limits work the same as Filter limits. See Filter Data from Your Views to learn more.
When finished, click OK.
The new set is added to the bottom of the Data pane, under the Sets section. A set icon indicates the field is a set.
The members of a fixed set do not change, even if the underlying data changes. A fixed set can be based on a single dimension or multiple dimensions.
To create a fixed set:
In the visualization, select one or more marks (or headers) in the view.
Right-click the mark(s) and select Create Set.
In the Create Set dialog box, type a name for the set.
Optionally complete any of the following:
By default, the set includes the members listed in the dialog box. You can select the option to Exclude these members instead. When you exclude, the set will include all of the members you didn't select.
Remove any dimensions that you don't want to be considered by clicking the red "x" icon that appears when you hover over a column heading .
Remove any specific rows that you don't want to include in the set by clicking the red "x" icon that appears when you hover over the row .
If the marks you selected represent multiple dimensions, each member of the set will be a combination of those dimensions. You can specify the character that separates the dimension values. To do so, for Separate members by, enter a character of your choice.
Select Add to Filters shelf to automatically move the set to the Filters shelf once it is created.
When finished, click OK.
The new set is added to the bottom of the Data pane, under the Sets section. A set icon indicates the field is a set.
If you created a set using specific data points, you can add more data to or subtract data from the set.
To add or remove data points from a set:
In the visualization, select the data points you want to add or remove.
In the tooltip that appears, click the Sets drop-down menu icon, and then select Add to [set name] or Remove from [set name] to add or remove data from a particular set.
After you create a set, it displays at the bottom of the Data pane in the Sets section. You can drag it into the viz like any other field.
When you drag a set to the viz in Tableau Desktop, you can choose to show the members of the set or aggregate the members into In/Out categories.
In Tableau Server or Tableau Online you can only aggregate the members of the set into In/Out categories.
In most cases, when you drag a set to the viz, Tableau displays the set using the In/Out mode. This mode separates the set into two categories:
In - The members in the set.
Out - The members that aren't part of the set.
For example, in a set defined for the top 25 customers, the top customers would be part of the In category and all other customers would be part of the Out category.
Using the In/Out mode makes it easy to compare the members in the set to everything else.
To show In/Out members in the visualization:
- In Tableau Desktop, right-click the set in the visualization workspace and select Show In/Out of Set.
When a set is in In/Out mode, the field on the shelf is prefaced by the text, "IN/OUT", followed by the set name.
Note: In/Out mode is not available in workbooks created before version 8.2 that use Microsoft Excel or text file data sources, workbooks that use the legacy connection, or workbooks that use Microsoft Access data sources.
Show members in a set
As an alternative to showing the set using In/Out mode, you can list the members in the set. Showing the members in the set automatically adds a filter to the view that includes only the members of the set.
To switch a set to list the individual members:
- In the visualization workspace, right-click the set and select Show Members in Set.
Note: To display the fully qualified member names for cubes, right-click the set in the Data pane and select Qualify Member Names.
You can use set actions to give your audience more control over their analysis of your visualization.
Set actions take an existing set and update the values contained in that set based on a user’s action in the viz. As the author, you can use a set or sets that you have already created to define the scope of the set action.
For details on how to create and use set actions, see Set Actions.
To give your audience the ability to quickly modify members of a set, you can also display a Set Control. A set control is a worksheet card that is very similar to a parameter control or filter card. You can add set controls to worksheets and dashboards and they are included when you publish to Tableau Server or Tableau Online, or save to the web on Tableau Public.
To display the set control, right-click (Control-click) the set in the Data pane and select Show Set.
Like other cards, set controls have a menu that you can open using the drop-down arrow in the upper right corner of the card. Use this menu to customize the display of the control, which supports both single-value and multiple-value selection modes. For example, you can show radio buttons for individual selection, or a drop-down list that supports multiple selections.
Note: You can only display a set control for dynamic sets—not fixed sets. This is by design, as fixed sets aren’t meant to change in membership. In addition, if the dynamic set is not in play in the view (that is, if it’s not referenced in a calculation or instantiated on the sheet), the context menu item will be disabled, reminding you to add the set to the view.
You can combine two sets to compare the members. When you combine sets you create a new set containing either the combination of all members, just the members that exist in both, or members that exist in one set but not the other.
Combining sets allows you to answer complex questions and compare cohorts of your data. For example, to determine the percentage of customers who purchased both last year and this year, you can combine two sets containing the customers from each year and return only the customers that exist in both sets.
To combine two sets, they must be based on the same dimensions. That is, you can combine a set containing the top customers with another set containing the customers that purchased last year. However, you cannot combine the top customers set with a top products set.
To combine sets:
In the Data pane, under Sets, select the two sets you want to combine.
Right-click the sets and select Create Combined Set.
In the Create Set dialog box, do the following
Type a name for the new combined set.
Verify that the two sets you want to combine are selected in the two drop-down menus.
Select one of the following options for how to combine the sets:
All Members in Both Sets - the combined set will contain all of the members from both sets.
Shared Members in Both Sets - the combined set will only contain members that exist in both sets.
Except Shared Members - the combined set will contain all members from the specified set that don't exist in the second set. These options are equivalent to subtracting one set from another. For example, if the first set contains Apples, Oranges, and Pears and the second set contains Pears and Nuts; combining the first set except the shared members would contain just Apples and Oranges. Pears is removed because it exists in the second set.
Optionally specify a character that will separate the members if the sets represent multiple dimensions.
When finished, click OK.
Note: This functionality is not available in workbooks created before version 8.2 that use Microsoft Excel or text file data sources, workbooks that use the legacy connection, or workbooks that use Microsoft Access data sources.
There are many ways you can use sets to answer complex questions and compare cohorts of data. Below are some examples of ways you can use sets to define and compare subsets of data.
No comments:
Post a Comment