Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
Step 1: Create a Calculated Field to use as our tooltip field
- Select Analysis > Create Calculated Field
- In the Create Calculated Field dialog box, do the following and click OK:
- Name the field. In the example, this field is called "Custom Tooltip for <field name>"
- Create a calculation similar to the following:
IF ZN(AGG()) = 0 THEN "" ELSE "" + STR(AGG()) + CHAR(10) END
- An example might look like the following formula when using the Sample - Superstore datasource:
IF ZN(SUM([Sales])) = 0 THEN "" ELSE "Sales: " + STR(SUM([Sales])) + CHAR(10) END
- This logic first converts all null values to zero, and if the value is equal to zero returns an empty string, otherwise it returns a string value of our tooltip.
- Be sure to match the aggregation to what was used in the view.
- Char(10) is a new line and this will make sense in our next step in order to streamline the tooltip as much as possible. Note: if this is the end of the tooltip the Char(10) is not necessary.
Step 2: Format our Tooltip for desired behavior.
- Drag our newly created calculated field onto the tooltip portion of the marks card.
- Edit our tooltip so that the formatting puts all our custom tooltip calculated fields in one line. For example:
<AGG(Custom Tooltip for some field)><AGG(Custom Tooltip for another field)>
The end result should look streamlined with nothing appearing for values that are null or zero.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials