Substring Autocompletion in Tableau

Tableau is great at drag-and-drop. This is one of the reasons it is so intuitive to use: visualizations are created in no time just by dragging fields to shelves. But we can also put fields in our view by typing directly in the Rows Shelf, the Columns Shelf, or the Marks Card. This can be nice and quick too, especially if you autocomplete with <TAB>. As it turns out, Tableau can even autocomplete strings when you start typing from the middle of the string! In other words, Tableau can autocomplete using substrings. It does not need the first letters of the word you are looking for (the entire string), but it can also use part of this word (a substring). This can be really useful as it often reduces the numbers of letters you need to type before you get the autocompletion you are looking for.

Efficient Autocompletion with Substrings in Tableau

In this blog I will give step-by-step instructions on how to use substring autocompletion in Tableau while editing inside Shelves. Note that this functionality can also be used in other places, e.g., the VizQL Calculation Editor. First, we will open the sample data set that we are going to use. Later, we will take a look at editing directly in the shelves and Marks Card. Then, we will look at how autocompletion with substrings can really speed up inserting text directly in the shelves.

Lastly, we will examine a use case where the combination of these techniques really shines in my opinion. Dragging-and-dropping is still the way to go in most cases, but directly typing really speeds up your workflow sometimes. Towards the end of this blog we will see how you can quickly create Ad Hoc Calculations in your visualization without having to make a Calculated Field, just by typing in the Rows Shelf.

In case you are wondering what string means: a string is just a sequence of characters, much like a word, but it might also contain spaces or punctuation (!@*# etc.). It can even contain returns or enters! For a more technical explanation see the following wikipedia article: https://en.wikipedia.org/wiki/String_(computer_science). So, by substring autocompletion in Tableau we mean Tableau’s autocomplete feature that allows us to use characters in the middle of the the name of a Field (or Function, Parameter etc.) to get to what we are looking for quickly.

Opening Sample – Superstore

We are going to use the Sample – Superstore example data set (supplied with Tableau). Connecting to this data set is simple in most cases. Just start Tableau. In the Start Page that opens just double-click Sample – Superstore. You can find it on the left side of the window (in the Connect Pane) under Saved Data Sources.

If you cannot find the Sample – Superstore, you can try the instructions in the following website:

Re-Adding Superstore or World Indicators to Saved Data Sources | Tableau Software

Typing in the Columns and Rows Shelf

We can add Fields to the Columns and Rows Shelves by double-clicking on the right side of the shelf. Then we can start typing. Suppose we want to show a vertical bar chart of sales by segment. In that case we could type “Segment” in the Columns Shelf and press the <RETURN/ENTER> key twice on the keyboard. Now the Segment Field is placed onto the Columns Shelf. Double-clicking to the right of the Rows Shelf and entering “Sales” would put the Sales Field onto the Rows Shelf. Putting multiple Fields onto one shelf in one go is also possible. For example: just type “Sales” on the Rows Shelf, press <TAB> twice, write “Quantity” and then press <RETURN/ENTER> 2 times, to put both the Sales field and the Quantity field on the shelf.

On a side note: we could also write “Sales⇥⇥Quantity⏎⏎”, where ⇥ and ⏎ simply stand for pressing the <TAB> and <RETURN/ENTER> key respectively.

Typing on the Marks Card

Let’s add something to the Marks Card by typing as well. This is pretty easy, but it might be a surprising feature. Just double-click somewhere in the empty area underneath the Marks Card Properties (Color, Size, Label, Detail, Tooltip). Now you can start typing. For example: type “Country” and press <RETURN/ENTER> 2 times(“Quantity⏎⏎”). This will insert the Country/Region Field onto the Marks Card. Now change the Marks Card Property from Detail to Color by clicking on the icon in front of the Country/Region Field on the Marks Card and selecting Color.

Autocompletion!

So far we just typed in Fields, but this can be done much quicker using autocompletion. When you type in one of the Shelves or the Marks Card, Tableau automatically suggests autocompletions. Pressing <TAB> inserts the first autocomplete suggestion made by Tableau. Since autocompletion is not case sensitive you can start typing lowercase letters. In order to complete the ‘Sales’ and ‘Segment’ Fields from before, just insert “s⇥⇥” and “se⇥⇥” respectively, where “⇥” simply means the <TAB> key. Also note that this can prevent typing errors: autocompletion in Tableau will just insert an existing Field or an existing VizQL Function. Another thing to note is that text insertion in the previous paragraphs already used autocompletion, albeit not very efficiently.

Autocompletion with substrings

If we want to autocomplete the Country/Region Field on the Marks Card we are confronted with a problem. “c” will autocomplete to the CASE Function and even “count” will not autocomplete as desired (the COUNT Function will be filled in). Only “countr” will complete properly when we press <TAB>. This is where autocompletion with substrings comes in! We know “nt” is a substring of “Country/Region” and the first suggested autocompletion in this Workbook is “Country/Region”. Inserting “nt” and pressing <TAB> will autocomplete how we want it even though “nt” is in the middle of the string we are looking for. That is nice!

Interestingly enough “nt” is not only a substring of “Country/Region”, it is also a substring of “COUNT”. But in this case Tableau’s autocomplete algorithm makes this the first hit.

Now we know “nt” autocompletes to “Country/Region”, we can use it everywhere and this decreases the amount of typing we have to do.

A word of caution: how Tableau autocompletes fully depends on the Workbook, what Fields are available etc. It might even be possible that the version of Sample – Superstore used in this blog autocompletes differently than your specific instance. On the other hand, you can just start typing and see the suggestions Tableau gives; you will automatically develop a feel for how your Workbook autocompletes.

Concluding Thoughts

Autocompleting Fields is not very useful in itself. We can achieve the same by simply dragging-and-dropping. It can be much more useful, however, if we want to create a quick New Calculation on a Shelf that is not saved as a Calculated Field. Say we want to quickly calculate per Segment what the total sum of profits is divided by the total sum of sales. Inserting “sum⇥prof⇥ / sum⇥s⇥⏎” on Rows and “se⇥” on Columns would do that.

I hope you found this blog useful and might consider using autocompletion with substrings on shelves and the Marks Card sometimes.

Visit our site The Information Lab NL to see more blog posts, training and consultancy services regarding Tableau, Alteryx and Snowflake.

Bel ons

Afspraak

Mail ons