KNOWLEDGE BASE

## Creating a String List to Display in a Tooltip

Published: 03 Sep 2015

### Question

How to display a list of values for a dimension in the tooltip.

### Environment

Tableau Desktop

The following instructions use Superstore sample data and demonstrate how to include a list of cities in the tooltip of a state. The result can be reviewed in the attached sample workbook.

### Step 1: Create the View

1. Select Analysis > Create Calculated Field...
2. `Enter the following Level of Detail calculation: { FIXED [State] : SUM([Sales]) }`.
3. Name the field Sales by State and click OK.
4. Double-click the State dimension to create a map view.
5. Place Sales by State on Color

### Step 2: Convert City to String

1. Right-click City and select Duplicate
2. Rename City (copy) to City (String)
3. Right-click City (String) and select Geographic Role > None
4. Place City (String) on Detail

### Step 3: Create Table Calculations

1. Select Analysis > Create Calculated Field...
2. Enter the following calculation:

`'-' + ATTR([City (string)]) + ' ' + PREVIOUS_VALUE('')`

3. Name the field City List and click OK.
4. Place City List on Tooltip.
5. Navigate to Analysis > Create Calculated Field...
6. Create a calculated field named City List Filter using the following calculation:

`INDEX() <> SIZE()`

7. Place City List Filter on Filters, and click OK.
8. Right-click City List Filter on Filters and select Compute Using > City (String).
9. Select False and click OK
10. Right-click  City List on the Marks Card and select Compute Using > City (string), then click OK.
11. Format the tooltip as desired.