Friday, June 23, 2017

Creating Search Box in Tableau

A search box allows us to find records in a data set using a keyword.

There are a number of ways to create a search box in Tableau. It depends on what you want to do. There are in general two kinds of searches: Dimension search or Global search.

Dimension Search
There are two ways to search within a dimension or a column.
- dimension filter search box
Each dimension filter has a search box embedded within. Just drop down the menu list and the search box will appear.
- wildcard search box
The second way is to set up the dimension filter as a wildcard filter, among options like single-select or multi-select filters. This approach is used in this Khan Academy viz.

Global Search
Sometimes we need to search in multiple columns or even all the columns. There come two approaches as well.
- combined field as dimension
We can combine all the columns of interest as a string to form a single column. Then use the above dimension filter for search, such as wildcard search.

- using parameter
This is a method that I saw here by Ken Black and I used it here in data dictionary search viz.

First, create a parameter, Search. The current value is left blank.
Then create a calculated field [Search Filter] as follows:
  • CONTAINS(Column1, Search) or CONTAINS(Column2, Search) or CONTAINS(Column3, Search) ...
Put this search filter in the filter shelf. Open the [Search] parameter to be the search box.

Voila, just a little summary on how to create search box in Tableau. The above is about using a single keyword to search. If using more than one word, the implementation could be a bit more complicated.

4 comments:

  1. Thanks! This was very helpful! But how do I reset the search box again to show all when doing the Global Search? Simply clearing the text within the search box and hitting enter doesn't seem to work..

    ReplyDelete
    Replies
    1. Did you try the example here http://vizdiff.blogspot.com/2017/06/visualizing-data-dictionary.html ?
      Clearing the text and hitting return does work for me.

      Delete
  2. Hello,

    It is so helpful post! Thank you for your blog.

    One question here though.
    I am using multiple data sources, and try to make search box effecting across the multiple sources. I have tried choose the field name from different data source in calculation, but it gives errors.
    Also, the parameter itself in dashboard does not have the function to apply to other sheets.

    Do you know how I can make it happen?

    Thanks!

    ReplyDelete
    Replies
    1. In each sheet, you should be able to use the same parameter to create a filter using CONTAINS(). Not sure what your issue is. You can ping me on twitter @aleksoft or send your workbook to me alexandermou2000 at gmail

      Delete