How To Perform Multi-Field Searching In #Tableau

 Summary

Introduction

Last week, I received a question from a developer that caused me to hesitate for a while to craft a solution. The complexity of his data situation caused me to remove myself from his example to be able to find a simple solution. What I show in this article is a solution for him and one that can be used in many situations.

The developer that created the question said that he had searched for a solution to this dilemma but could not find one. He reported that some solutions were close to what he needed, but he was unsuccessful in finding his answer.

This solution is a general use Tableau technique, so I thought this method would make a useful article. In some ways, the solution is so simple that I hesitated to write this, but I’ve learned that things like this will benefit people in the future if I take the time to show how it is done.

The Problem Statement

There is a need in a dashboard to be able to find someone based on their name or their email. The solution to this problem requires that you simultaneously search more than one data field and create a strategically filtered list to return records that match a search condition. In general, you can search two or more fields, if needed, but I’ll show an example of searching two fields.

The Example Data

As shown in Figure 1, an example database has a list of names and emails, and the goal is to be able to find someone based on either their name or email. This forces a simultaneously filtering on the name and email fields. The developer did not want to have the users click on two separate filters (name, and email) and force them to simultaneously interact with these two filters (i.e., manually click the “all” button in the opposite filter) because this leads to a bad user experience.

Example_data

Figure 1 – Example data file having names and emails. The goal is to be able to find someone either by name or by e-mail. Note that I have intentionally shortened the column widths to avoid showing the complete data.


The Multi-Field Search Solution

The solution to this problem is to use a parameter coupled with a calculated field and specific filter settings. The parameter should be a string and named like the one shown in Figure 2.

Parameter_Search_Box

Figure 2 – The parameter should prompt the user to enter a term a search term. In this case, they will be searching the Name and Email fields.


The search term that is entered in the parameter search box will be used in a calculated field as shown in Figure 3. This calculated field will return a true or false. In this case, only two fields are searched: Name and E-mail. Whenever a record in the Name or E-mail fields match the search condition entered in the parameter search box, those fields are marked as true and will be returned to the dashboard.

Show_Matches

Figure 3 – The Show Matches calculated field which will find all the records that match your search condition.


Figure 4 shows the filter settings that allow this technique to work. For each worksheet you are using in a dashboard, you will need to include the calculated field in the filter card as shown in Figure 3.

Filter_settings

Figure 4 – The Show Matches condition needs to be included on any worksheet you want to include in the searching.


When in operation, the dashboard will be dynamically updated with whatever you search for in the parameter search box. Figure 5 shows the results achieved by searching for the word “black”.

dashboard

Figure 5 – Search results for the word “black”.


Instructional Video

A short instructional video is shown below that gives some examples of how this could be used. In general, this methodology can be used to find groups of people with common emails such as “gmail”, or it can pin-point individuals with specific email addresses or names. This is one reason why this technique is so nice.


Final Thoughts

I first developed this technique when I created my 3danim8 blog Tableau-powered search engine. This technique is incredibly powerful in a wide variety of cases.  I encourage you to see the power of this by exploring this blog for your own search terms. Thanks for reading.

 

Update Two Days Later

The developer just skyped me with a message that is shown in Figure 6.

 

solution

Figure 6 – This type of reaction is what makes Tableau so valuable.

 

Leave a Reply

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