知識庫

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


發佈時間 : 13 Apr 2021
上次修改日期 : 14 Feb 2023

問題

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
 

 

 

環境

  • Tableau Desktop

答案

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.
這篇文章是否解決了問題?