KNOWLEDGE BASE

Adding Dynamic Descriptions Based on Selection


Published: 28 Oct 2013
Last Modified Date: 20 Jul 2023

Question

How to show a unique string annotation for each dimension member selected on a dashboard.

Environment

Tableau Desktop

Answer

Option 1 - Using a Calculated Field

Step 1 - Create a calculated field for the text

  1. Select Analysis > Create Calculated Field...
  2. In the Calculated Field dialog box that opens, do the following and then click OK:
    1. Name the calculated field. In the example workbook, the calculated field is named Statement Text.
    2. In the formula field, create a calculated field similar to the following:
      CASE [Region]
      WHEN "Central" THEN "This is the Central Example"
      WHEN "East" THEN "This is the East Example"
      WHEN "South" THEN "This is the South Example"
      WHEN "West" THEN "This is the West Example"
      END

Step 2 - Create the dashboard

  1. Create a new Sheet called "Example 1". 
  2. Drag Region to Rows and Profit to Columns.
  3. Create a new Sheet called "Example 2".
  4. Drag Region to Rows and Category to Columns.
  5. And drag Profit to Text
  6. Create a new Sheet called "Statement". 
  7. Drag "Statement Text" to the Text card.
  8. Drag the 3 new created sheets into a new dashboard.
  9. Adjust the size of each sheet as necessary to fit the dashboard.

Step 3 - Create an action filter

  1. Select Dashboard >  Actions...
  2. Select Filter...
  3. Name the field, for example: Text
  4. In the Source Sheets, check only the worksheets that will be clicked to filter the Statement worksheet (in this example, select Example 1 and Example 2)
  5. In the "Run action on" menu, choose the Select option.
  6. In the Target Sheets section, check only the Statement worksheet (in this example, select Statement)
  7. Set the "Clearing the selection will:" option to Exclude all values.
  8. Make sure that the "Target Filters" option is set to All Fields.
  9. Click OK.
  10. Click OK.
 

Option 2 - Using a parameter

Step 1 - Create a Parameter

  1. Click the arrow next to the Dimensions panel and select Create a parameter.
  2. Name the parameter "Choose a measure".
  3. In the Data Type, choose String.
  4. In Allowable Values, select List.
  5. In the List of Values add the measures that you wish to filter.
    1. In this example, add Discount, Profit, Profit Ratio, Quantity and Sales. 
  6. Click OK.

Step 2 - Create a calculated field for the text

  1. Select Analysis > Create Calculated Field...
  2. In the Calculated Field dialog box that opens, do the following and then click OK:
    1. Name the calculated field. In the example workbook, the calculated field is named Display Measure.
    2. In the formula field, create a calculated field similar to the following:
      CASE [Choose a measure]
      WHEN "Discount" THEN SUM([Discount])
      WHEN "Profit" THEN SUM([Profit])
      WHEN "Profit Ratio" THEN [Profit Ratio]
      WHEN "Quantity" THEN SUM([Quantity])
      WHEN "Sales" THEN SUM([Sales])
      END

Step 3 - Create the dashboard

  1. Create a new Sheet called "Parameter Example".
  2. Drag "Region" to Rows and "Display Measure" to Columns.
  3. Right click on the parameter "Choose a measure" and select Show Parameter control.
  4. Create a new Dashboard and drag the Parameter Example sheet. 
  5. Drag a Text Tiled Object.
  6. Add the text of your choice and click Insert <Parameters.Choose a measure>.
  7. Interact with the parameter control.

Additional Information

To view these steps in action, see the video below: 


Did this article resolve the issue?