This blog provides the answers to the Tableau set action tasks found here.

Proportional Highlighting

  • Create the two sheets, segment by sales and sub-category by sales.
  • Right click the segment dimension and create a set.
  • Place the segment set on the colour card in the sub-category sales sheet.
  • Place both sheets in a dashboard and add a dashboard action.
  • Select change set values, choose your segment sales sheet as the source sheet and run action on select.
  • Choose the sample superstore data source and the segment set.
  • Clearing the selection will remove all values from set.

Asymmetric Drilldown

  • Create a bar chart of sales by category and create a set from the category dimension.
  • Create the calculated field: IF [Category Set] THEN [Sub-Category] ELSE “” END.
  • Create a set from this calculated field.
  • Create another calculated field: IF [Set created from first calculated field] THEN [Product Name] ELSE “” END.
  • Place these calculated field on rows in order of creation.
  • Add two worksheet action to change set values, both running on menu, and removing all values from set when clearing selection. One uses the category set as target and the other uses the set created from the first calculated field.

Colour Scaling

  • Create a map view with state on detail.
  • Create a set from the state dimension.
  • Create the calculated field: IF [State Set] THEN [Sales] END. Put this on the colour card.
  •  Add the worksheet action to change set values on select with the target set as your state set. Clearing the selection will add all values to set.

Replace Tooltip with In Set Highlighting

  • Create a scatter plot with profit on columns, sales on rows and sub-category on detail.
  • Create a sub-category set and place this on the colour and size cards (make it so that members in the set are larger).
  • Create the calculated field: IF [Sub-Category Set] THEN [Sub-Category] ELSE “” END. Put this on the labels card.
  • Create the calculated field: IF [Sub-Category Set] THEN [Profit] END. Put this on detail then add a reference line to the profit axis with this as the value and the label set to value.
  • Do the same again but replacing [Profit] with [Sales] and creating the reference line for the sales axis.
  • Add the worksheet action to change sub-category set values on hover, keeping set values when clearing the selection.

Proportionally Highlight Viz in Tooltip

  • Create a map view with country on detail, coloured by quantity.
  • Create a country set.
  • Create a new sheet of quantity by category and put the country set on colour.
  • On the map sheet add a worksheet action changing the country set value on hover and removing all values from set hen clearing selection.
  • Insert the quantity by category sheet into the tooltip of the map sheet and remove <All Fields> from between the quotation marks after filter=.

Drilldown Using Levels

  • Create a category set. Reference this set in the calculated field (CF1): IF [Category Set] THEN [Sub-Category] ELSE [Category] END.
  • Create a set from this calculated field. Reference the category set and this newly created set in the calculated field (CF2): IF [Category Set] AND [CF1 set] THEN [Product Name] ELSEIF [Category Set] THEN [Sub-Category] ELSE [Category] END.
  • Put this newly created calculated field (CF2) on rows and sales on columns. Put this calculated field, category and CF1 on detail.
  • Create the calculated field (Level CF): IF [Category] = [CF2] THEN “Category” ELSEIF [Sub-Category] = [CF2] THEN “Sub-Category” ELSEIF [Product Name] = [CF2] THEN “Product Name” END.
  • Create another calculated field: IF {COUNTD([Level CF])} = 1 THEN (IF ([Level CF]) = “Category” THEN “True” ELSE “False” END) ELSEIF {COUNTD([Level CF])} = 2 THEN (IF ([Level CF]) = “Sub-Category” THEN “True” ELSE “False” END) ELSEIF {COUNTD([Level CF])} = 3 THEN (IF ([Level CF]) = “Product Name” THEN “True” ELSE “False” END) END.
  • Put this final calculated field on the filters shelf and select “True.”
  • Create two worksheet actions changing set values which run action on select and remove all values from set when clearing the selection. The target sets will be the Category set and the CF1 set.
  • Create the following calculated field for the title: IF [Level CF] = “Sub-Category” THEN [Level CF] + ” (” + [Category] + “)” ELSEIF [Level CF] = “Product Name” THEN [Level CF] + ” (” + [Category] + “, ” + [Sub-Category] + “)” ELSE [Level CF] END. Put this on detail and use it as the worksheet title.

Proportionally Highlight and Drilldown

  • Create a sheet with country on the rows and distinct count of Id’s on the columns.
  • Create a country set and reference it in the calculation: IF [Country Set] THEN [Company…City] ELSE “” END.
  • Create a set from the above calculation (City Set) and reference it in a new calculation: IF [City Set] AND [Country Set] THEN [Company.Name] ELSE “” END.
  • Put these calculations in order of creation on the rows shelf.
  • Create a new sheet with a treemap using a distinct count of Id and Category.
  • Create a category set and put this on the colour card of the bar chart sheet.
  • Put these two sheets on a dashboard and add an action using the treemap sheet as the source. Change the category set values on hover and remove all values from set when clearing the selection.
  • Add two more set actions which act on select and use the bar chart sheet as the source sheet. Make clearing the selection remove all set values and on one reference the country set and on the other reference the city set.

Colour Scaling and Scatterplot Highlighting

  • Create a map sheet with country on detail and create a set from the country dimension.
  • Create the calculated field: IF [Country Set] THEN [Episode] END. Put this on the colour card.
  • Create a new sheet plotting count of episodes against distinct count of seasons.
  • Put the country set on size and on colour. Make the larger size for members of the set.
  • Put these sheets on a dashboard and add a change set values action using both sheets as a source sheet. Make the target set the country set which runs on select and adds all values to the set when clearing the selection.

Fatalities Dashboard

  • Create calculated fields for month year (MY) and month day year (MDY) by right click dragging event date to the rows and choosing MY/MDY then dragging the pill to a calculated field.
  • Create a year set. Reference this set in the calculated field (MY Level): IF [Year Set] THEN [MY] ELSE [Year] END.
  • Create a set from this calculated field. Reference the year set and this newly created set in the calculated field (MDY Level): IF [Year Set] AND [MY Level set] THEN [MDY] ELSEIF [Year Set] THEN [MY] ELSE [Year] END.
  • Put this newly created calculated field (MDY Level) on rows and fatalities on columns. Put this calculated field, Year and MY Level on detail.
  • Create the calculated field (Level): IF [Year] = [MDY Level] THEN “Year” ELSEIF [MY] = [MDY Level] THEN “Month” ELSEIF [MDY] = [MDY Level] THEN “Day” END.
  • Create another calculated field: IF {COUNTD([Level])} = 1 THEN (IF ([Level]) = “Year” THEN “True” ELSE “False” END) ELSEIF {COUNTD([Level])} = 2 THEN (IF ([Level]) = “Month” THEN “True” ELSE “False” END) ELSEIF {COUNTD([Level])} = 3 THEN (IF ([Level]) = “Day” THEN “True” ELSE “False” END) END.
  • Put this final calculated field on the filters shelf and select “True.”
  • Create a new map sheet using country as the level of detail.
  • Create a country set and reference it in the calculation: IF [Selected Countries Set] THEN [Fatalities] END. Put this on the colour card.
  • Create a new sheet with event type on columns and count of events and create a new countries set with a different name. Put this set on colour.
  • Set the bar chart sheet as the tooltip in the map sheet and remove <all fields> from the filter.
  • Create a new sheet plotting the distinct count of events against the number of fatalities. Put the location on detail.
  • Create a location set and use this on size and colour.
  • Create the calculated field: IF [Location Set] THEN [Location] ELSE “” END. Put this on the label card.
  • Create the calculated field: IF [Location Set] THEN “Fatalities per event” ELSE “” END. Put this on along with a calculation finding the fatalities per event on the labels shelf.
  • Create the calculated field: IF [Location Set] THEN [Fatalities] END. Do the same for Events id instead of fatalities and place both fields on detail. Use these for reference lines on their respective axes.
  • Add all the sheets to the dashboard and add two worksheet actions changing set values which run action on select and remove all values from set when clearing the selection. The target sets will be the Year set and the MY set.
  • Add a dashboard action using the country set from the map sheet and use the map sheet as the source sheet. Make it run on select and add all values to set when clearing the selection.
  • Add another dashboard action using the other countries set and again use the map sheet as the source sheet. Make it run on select and add all values to set when clearing the selection.
  • Make a final dashboard action with the scatterplot as the source sheet and the location set as the target set. Make it run on hover and keep set values when clearing selection.