KNOWLEDGE BASE

How to Create a Dynamic Tooltip to Display Different Values for Different Measures


Published: 13 Apr 2021
Last Modified Date: 14 Feb 2023

Question

How to create a dynamic tooltip to display different values for different measures?

For example, when using Measure Names to display several values, how do you alter the Tooltips data based on the Measure you selected?
User-added image
 

 

 

Environment

  • Tableau Desktop

Answer

Using a parameter action can achieve this function as shown below and demonstrated in the attached package workbook.

1. Create a string parameter with the name _Measure Names as shown below:
User-added image

2. Create a calculated field with the name _Measure Sum to show the SUM of measures with the below calculation:
     *Note: the { SUM([Sales])} is the short version for {FIXED: SUM([Sales])}
IF [_Measure Names]="Sales" THEN { SUM([Sales])}
ELSEIF [_Measure Names]="Profit" THEN { SUM([Profit])}
ELSEIF [_Measure Names]="Quantity" THEN { SUM([Quantity])}
END

3. Create a parameter to transfer the hovered Measure Names to the _Measure Names parameter as shown here:
User-added image

4. Add the calculation _Measure Sum to the tooltip and edit the tooltip to show the dynamic SUM for different measures as demonstrated below:
User-added image

Please check the attached workbook for details.
Did this article resolve the issue?