Skip to main content

How to Search for Short Lists in Tableau

Ever have a situation where you’ve got 10 or 20 individual items or order numbers you want to search for? It’s a pain to select each individual value (say for instance, we just want to look up a batch of OrderIDs).

How can we build something easy in Tableau to make this happen?

I built this dashboard so we can envision what this could look like. It’s got some top level metrics when nothing is entered, but will dynamically change to views on order ideas when they are copy and pasted into the search box!

And it’s easy to build in Tableau! Just a couple calculations and you’ll be on your way.

Step 1: Create a Parameter:

Make sure you’ve set it to string.

Step 2: Create the Calculation that Operates the Parameter

The action is a pretty simple match — we just have to adjust the inputs so that it will match what we’re putting into the parameter! Hence the addition of the commas on either side of the parameter and OrderIDs in the data.

Here’s the text for quick copy and paste:

if contains(“,” +[Parameters].[Selected Order IDs]+ “,” , “,” + [Order ID]+ “,”)== TRUE then  [Order ID] else NULL END

Then you can just put this pill onto your rows shelf, and it will act as a dynamic dimension.

Step 3: Configuring the Filter with your new Dynamic Dimension

This particular calculation will always give you some sort of NULL value.

Why?

Its because of the question we’ve built into the calculation. After all, we are asking Tableau to compare our manually entered parameter values against EACH OrderID in the data. Inevitably there will be a couple that don’t match! These will return the NULLs.

And Tableau is working exactly as we expect – all we have to do is “hide” these nulls.

I’ve chosen to do it with an “Exclude” on the filter with a Custom value list.

BONUS STEP: What do I do if the sheet goes blank?

You’ll notice that if no values are entered, your sheets will turn blank.

In my case, I’ve taken full advantage of that by overlaying sheets that will appear when no values are entered. This is just an extension of the oft-written about Show/Hide sheets functionality based on the number of characters in the parameter.

A pretty specific use case – but I think could have a lot of practical applications especially for call center teams!  Happy Vizzing!

Leave a Reply

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