Blog from June, 2021

Self-updating Tool-tips

Here’s an interesting idea, tooltips that update as you move over data:

Specifically, a tooltip that increases as you roll across a selection of months, so as you hover over January, only January shall appear in the tooltip, similarly, if you hover over May, then all 5 months from January to May shall present

How:

  1. Create an integer parameter to hold the month number: Jan = 1, Feb 2 etc

  2. Create a boolean index() function scoped to the month, so Jan = 1, Feb = 2 March = 3 etc and as part of the calculation, set as Index() < parameter +1. Performing a less than calc evaluates faster than <=

  3. Now move your Index calc to the filters selecting True. This can be tested by materialising the parameter and manually updating the values

  4. On your primary sheet set the filter on the tooltip either to: fields="" for no filtering or, if you have items to filter, add these instead

  5. In the worksheet actions, set a update parameter action, set the action to hover, target your parameter and set the month of your date, ensure this is min (or max) therefore only the month number shall be captured.

Ok, so Tableau haven’t so much added a new object type, but have actually extended the functionality of parameters such that they can now function as in/out updatable variables, all achievable from the addition of a new-ish action filter - Change Parameter… (See this and all other features here).


Parameters: everyone’s seen them and most of us have used them at some point, they are the unsung heroes of Tableau; some of the things you can do with parameters (though really this list is far, far bigger):

  • Use in logic calculations to determine an output

  • Control chart visibility

  • Globally accessible data filter either through text or numerical output

  • Alter textbox data

  • Create dynamic data queries when combined with CustomSQL

  • Change chart dimensions or measures

  • Adjust chart structure

  • Control button functions

  • Change data types for different display

  • Switching between date periods

  • Controlling comparative calculations such as lookups

  • Adjusting TopN outputs

  • Use with URL’s for web-redirection

  • Use in place of filters

  • Dynamically change Top/Bottom-N functionality when combined with table calcs

So the function has been available for 2 years now (at the time of writing), having been included with the v2019.2 release, though few people I encounter in the community have come across this awesome feature:

I’m in the midst of a very long love-affair with Tableau beginning back in September 2008 yet for me, this one feature is the greatest function that has been included, before or since.

Seriously? That’s just crazy I hear you shout

What about:

  • Level-of-detail expressions

  • Ask-data

  • Cross-platform connectivity

  • Responsive layouts

  • Python an R connectivity

  • Animated visuals

  • Extensions

  • Show/Hide button for containers

  • Set Actions

To name but a few; are you really that sure about the Change Parameter action? Can it really be that good?! You exclaim

Actually, it’s better

Let’s revisit that list of some of the uses you could already achieve with parameters, imagine how much more you can achieve if you can control and alter the value of the parameter just by interacting with a viz; no filters, or functions sitting at the top or the side, adding unnecessary clutter that forces a user away from the viz, even for a split second, whilst they look to drill further. 

No quickfilters that need to be thought-out and defined for performance that lure your users into meddling for the sake of it; now, to paraphrase Tableau’s original tag-line, users can answer questions at the speed of thought.

One example is the self-updating tooltip demonstrated here: Datawonders: Self-updating Tooltips, this is just not possible without the Change Parameter

And what about advanced dynamic SQL?

For more than 10 years now, we’ve been able to control data using a combination of SQL queries written into the CustomSQL object, combined with parameters to create fairly dynamic SQL. With this function however, we can now control all disparate sources, without needing to join, blend or define a relationship or set a related field for filtering.

The addition of this one incredibly powerful function has brought an entire new level of interactivity that ensures a user can truly interact without ever needing to hunt for a filter:

Take a look at this viz for example Demo Dashboard - Steve | Tableau Public 


Not a single filter in sight, but everything is filterable: want to change the measure from Sales to Profits? Click the BAN, want to focus the dashboard to a specific state? Click the choropleth. Notice how when you open the city selector, this list is sorted from largest to smallest numerically and is responding to your actions selected BAN, State, Segment, Product Type, and then selecting a city, re-focusses your entire dashboard.


All powered by parameters. 


Nb, those expansions at the top corners of each of the charts, are actually discrete page nav’s redirecting you to an identical page but with a larger version of the chart, but by using parameters, all the page and chart titles remain allowing users to remain focussed and not lose their story as they traverse this view and dig deeper.

Some other examples in addition to the above list include:

  • Filter / unfilter actions similar to the breadcrumbs provided with Qlik Sense but much, much nicer and fully customisable

  • Higher performing dashboards and load times as Tableau no longer needs to build quick-filters

  • Joshua Milligan’s incredible Minesweeper repro just couldn’t be achieved without them: Tableau Minesweeper - Joshua N. Milligan | Tableau Public

  • Focussed LODx and pass-through expressions - looking at sales by region, wanting to know the top-selling product for the region is handled by a LODx, bung a parameter in the expression linked to cities, have a user click the city and watch as your viz tells you the top-selling product for the city

  • Use in conjunction with page navigation, setting a filter as a user selects an item, and navigating to the pre-filtered page, all in one click


But how is this magic achieved? Let’s quickly run through this using Superstore (ensure you have set your location data to the US: Map > Edit Locations > Set Country/Region to United States):

  1. Create an empty string parameter, it’s going to be used as a variable so we’ll prefix to ‘v’: vRegion, and set an initial value of West

  2. Create a filter calc fRegion set to the region, we’ll define as boolean as these evaluate the fastest: Region = vRegion

  3. Now create a couple of charts:

    1. First a Choropleth: Longitude to columns, Latitude to rows, Sum(Sales) to colour, State to the label, fRegion to the filters selecting True

    2. Next a bar: Region to the columns, Sales to the rows, fRegion onto the colours

  4. Now a dashboard, drag both vizzes to the dashboard

  5. Now is where the magic happens - we’ll set this so the choropleth zooms to the States in a selected region controlled by the bar chart:
    Create a new dashboard action: Dashboard > Actions > Add Action > Change Parameter…

  6. In the dialogue:

    1. Set the bar chart as the source

    2. Run action on select

    3. Target Parameter = vRegion

    4. Field = Region

  7. Press OK


That’s it, selecting a region from the bar chart, not only does the selected region highlight, but the choropleth also focuses the map to the States in that region.

** Originally published to Tableau community forum (need to login first): Tableau Community Blogs - Psst! Have you had a go with variables in Tableau yet?