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.
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.
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.
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.
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”.
Figure 5 – Search results for the word “black”.
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.
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.