All IT Courses 50% Off
Tableau Tutorials

How to Keep The Rank Using Tableau Viz In Tooltip

When utilising a Tableau viz in the tooltip, do you want to keep the rank? A viz in a tooltip will by default filter the sheet in the tooltip.

The rank is affected by this filter because of the order of operations. The filter will naturally rank first if it retains only one record. After the elements are eliminated (filtered out) from the sheet, Tableau determines the rank; as a result, the last item consistently ranks first!

Use a late filter, or a table calculation filter, to preserve the rank in a conventional chart after a filter. A table calculation filter preserves the rank since it applies the filter after the rank has been determined.

But in this instance of a visualisation in a tooltip, the filter takes place before the rank computation. Therefore, when utilising a vis in a tooltip, the rank is not retained.

The difficulty lies in maintaining the rank without resorting to a table computation filter, which I don’t believe is achievable when utilising a visualisation in a tooltip. To learn more, check out the Tableau online training

All IT Courses 50% Off

How To Maintain The Rank With A Tableau Viz In Tooltip

Thankfully, there is a (partial) fix. This solution makes use of Set Actions, just like the one that displays grand totals in a viz in a tooltip.

The easiest approach to illustrate how to utilise set actions to resolve this “rank in tooltip” issue is with a straightforward example.

How to Keep The Rank Using Tableau Viz In Tooltip
  • Construct a straightforward bar chart that displays profit by market using the sample superstore data set. Include the rank in this chart; in this case, the rank is determined by using the Index function. A Rank function is a simple substitute. Whatever suits you best.
  • The sum of Profit is used in descending order for the custom sort order used in the rank computation. This implies that the rank will always be determined by the total profit, regardless of the order in which the markets are listed.
  • There are still some gaps in the tooltip chart. Give it the name TooltipBar, and we’ll be back soon to finish it.
  • Next, create a basic line graph. The Tableau dashboard will display this chart, and the bar chart will show in the tooltip when the user hovers over a line.
  • With each line denoting a market, this line graph displays sales over time.
  • The graphic is now created in the tooltip. Insert the sheet and make edits to the tooltip.
  • The bar chart can be filtered by market and time period by hovering over a line. When one market is filtered by this, the rank is always 1. We take action because we don’t want this to occur.
  • Go back to the tooltip chart, which is the bar chart. In the list of dimensions, right-click the Market pill, then select Create – Set.
  • Select any market to use for this set. It doesn’t matter which option you select; the tooltip will change due to the set action.
  • The Market Set pill should be the first pill on Rows in the chart. This implies that the Market in the set comes on top after sorting the Markets. Additionally, use the Edit Table Calculation of the rank calculation to confirm that the rank is accurate. you ensure that this field is ignored in the rank computation, be sure you choose or check the Market Set dimension.
  • Once back on the Line sheet, change the tooltip. Take off the filter fields from the tooltip visualisation.
  • This disables the tooltip viz filtering; the display will henceforth be handled by the set and set actions.
  • Nearly finished; still needs to construct the set action and finish building the dashboard.

Build the dashboard and Set Action

  • Add the line chart to a freshly opened, blank dashboard.
How to Keep The Rank Using Tableau Viz In Tooltip
  • The Set Action: Dashboard – Actions menu bar item should then be created.
  • Make a brand-new Set Action. Adjust the Set Values Add Action.
  • The Market Set should be the set to alter, and on hover, it should assign values to sets. Selecting “Keep set values” will clear the selection. As the tooltip appears, make sure it is running on hover.

That’s it, guys! Hovering over a Market line causes the bar chart to appear in the tooltip, with the Market at the top and the rank displayed next to it.

Organise the tooltip bar chart. You can size and colour the markets. The markets in the set will be larger than the markets outside of it. Enhancing the appearance further involves hiding the Set field’s heading.


You can learn more about Tableau Viz by checking out the online Tableau course.

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button