Creating Sankey Charts the Easy Way with Tableau

Historically, creating Sankey charts in Tableau has been a time-consuming process, often requiring the use of complex templates. However, the team at Tableau Public has introduced a game-changing functionality that allows us to create Sankey charts effortlessly. This feature, currently in beta and available for a limited time (like the McRib of data visualizations), enables us to author and publish Sankey charts directly to our Tableau Public profiles.

In this blog post, I’ll briefly walk you through the process of creating one using Tableau Public.

What is a Sankey Chart?

Before we delve into the specifics of this new Tableau Public feature, let’s take a moment to understand what a Sankey chart is and why it’s such a powerful visualization tool. A Sankey chart is a flow diagram that illustrates the movement of data, be it goods, energy, or even money. With a Sankey chart, you can effortlessly compare different data points and identify patterns that might remain hidden in traditional charts or tables.

Testing Out the New Feature

Assuming you already have a Tableau Public profile (and if you don’t, I highly recommend creating one—it’s an incredible platform for sharing your data visualizations with the world). You’ll need to create a visualization directly from your Tableau Public page.

Once you’ve created your visualization, navigate to the “Connect to Data” section. As we’re uploading data from our computer, select the “Upload from Computer” option. Choose the dataset you want to work with—I’ll be using the “Sample Superstore” dataset for this example. After confirming that your data has been successfully imported, select the “Sankey” chart type.

Now, here’s where the magic happens. You’ll notice a “Level” and “Link” section that appears. To define the flow in the Sankey chart, let’s select a dimension like “Segment” and drag it into the “Level” area. Next, grab another dimension—I’ll choose “Region”—and place it in the “Level” area as well. Finally, to quantify the flow, let’s choose a measure like “Sales” and place it in the “Link” area.

Voila! With just a few clicks, we’ve created a Sankey chart. Impressive, isn’t it? You’ll notice the flow between the segments and regions instantly come to life. But we’re not done yet—let’s keep the party going by adding another level.

For the sake of experimentation, let’s grab a dimension like “Ship Status” and drop it into the visualization. Now we have an additional sub-level in our Sankey chart. To avoid overcrowding, we can uncheck the “Allow Labels to Overlap” option, ensuring our chart remains clean and legible.

Keep Innovating for The Analytics Core Audience

Tableau Public’s decision to incorporate this feature highlights their commitment to democratizing data visualization. While the addition of features like Sankey charts to Tableau Public is fantastic, it’s essential that the overlords at Salesforce remember Tableau’s core audience—the general analytics users who are generally decoupled from Salesforce usage. Let’s keep hoping for bigger and better things to come with the tool. This beta signals that they’re heading in the right direction.

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please check out the logo shop here.

Stay in contact with me through my various social media presences.

Thank you!!

Anthony B Smoak

(Note: The mentioned feature and availability were accurate as of the blog post’s publication date, but please refer to the Tableau Public documentation for the latest updates and information.)

Advertisement

Learn Advanced Tables in Tableau (Step by Step)

TLDR

Yes I put an AI version of myself on the thumbnail. I obviously “Quantum Leaped” from the future to teach you these Advanced Tableau table skills that you’ll encounter in the accompanying video.

Be warned, this is Highly Advanced Tableau!! In the main video, we’ll explore how to generate advanced tables in Tableau (step by step), complete with multiple chart elements displayed on the same table row. It’s OK, you can click the area below since it leads to a YouTube short.

Intro

As a data enthusiast and Tableau user, I always strive to learn new things, experiment with different techniques and share my knowledge with others. Recently, I came across a visualization by Zainab Ayodimeji that caught my attention. Zainab is a Tableau Ambassador and her work is always top-notch, so I reached out to her and asked if I could reverse engineer one of her vizzes for a video. She was cool with it, so I got to work.

The visualization that caught my eye was an advanced Tableau visualization that used normalized data to create sales and profit sparklines for using standard Superstore data. Zainab’s visualization featured a variety of different chart elements, all on the same row, and looked incredibly cool.

I was immediately intrigued and wanted to see if I could reproduce something similar myself, but with a different data set other than the ubiquitous Superstore. So, I got to work on reverse engineering and came up with my own take on Zainab’s visualization.

I discovered that the technique used in her viz was innovated by Sam Parsons, so I also checked out his video on this technique and found it ingenious; very MacGyver like. Sam’s innovative video is the inspirational source for all of these techniques. Watch his video for the concepts, watch my video for practical hands on building.

Watch the Step by Step Re-creation Video to Learn this Advanced Technique

In the video below, I will explain step by step how I used Tableau to create a compelling chart example that will help my viewers understand the Advanced Tableau calculations and concepts it takes to visualize multiple types of charts on one table row.

The dataset that I worked with contained information about the sales and profits of different products sold at a coffee shop as opposed to Superstore data. Recreating the data with a different dataset forced me to understand the concepts better than just copying and pasting the existing code in Zainab’s visualization.

The Reviews are In

Y-Axis Positioning Trick – (How this Process Works)

One of the coolest concepts in this process is the positioning of the chart elements on the same Y-Axis. Again, a big shoutout to Sam Parsons for coming up with these techniques!

The y-axis position is critical because it determines where each data point will be plotted on the chart. As a result of the ingenious calculation, Tableau places all non-line chart elements at a y-axis position of 0.5, which is the middle of the y-axis. However, for line chart elements, the y-axis position is calculated based on the normalized sales or profits value.

To normalize the data, we make the values of the sales and profit of each product fit between a range of 0 and 1 for a consistent Y axis. This allows us to see the trends of the sales and profits of each product at a standard consistent height on the visual.

The sales or profit axis test (a calculated field) determines whether the normalized sales or profits value should be plotted if the chart element is a line. If the test returns a value of 1, Tableau will plot the normalized sales value. If it returns a value of 0, Tableau will plot the normalized profits value. This is determined by checking whether the sales access product field is present in the detail section of the view.

Download the Workbook for This Technique

Download at this link.

Conclusion

I just realized that I used Quantum Leap and MacGyver references in the same blog post (gettin’ Ziggy with it). After watching my video above, you’ll be able to create an insightful visualization using clever and unconventional methods (not unlike MacGyver making a jetpack out of a toothpick and a piece of gum).

Again, big thanks to Zainab and Sam for influencing this work so I could teach you how to Quantum Leap forward in your Tableau skills (Ok I’ll stop with the puns). Keep doing great things with your data!

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please check out the logo shop here.

Stay in contact with me through my various social media presences.

Thank you!!

Anthony B Smoak

Perform Fuzzy Matching in Tableau Prep

TLDR

Life is too short for exact matches!

In this video I will build out a Tableau Prep flow that demonstrates one approach to perform fuzzy matching. We’ll perform the fuzzy matching technique on two lists of companies. One list contains a standardized list and the other contains a non-standardized list, and we will match them together using Tableau’s fuzzy algorithm.

Intro

As a working data professional, one of my main responsibilities is to ensure the accuracy and consistency of the data that I work with. One of the challenges I face is dealing with different variations of company names that may exist in different datasets. In the video above, I walk you through a fuzzy match join that I recently performed using Tableau Prep, a data preparation tool, to reconcile these variations.

What is Fuzzy Matching?

First, I want to introduce you to the concept of fuzzy matching. It’s a technique used to match data when there are slight differences in how the data is presented (most likely as a result of bad data governance). For example, if you have two data sets with company names, one may list a company as “Apple Inc.” while the other may list the same company as “Apple Incorporated.” Fuzzy matching would help you match these two records, even though the names are slightly different.

In Tableau Prep, unfortunately fuzzy matching is not a straightforward process like it is in Excel or other tools like Power BI or Alteryx. However, we can use a workaround to achieve a somewhat similar result. Tableau Prep allows you to automatically group values together using fuzzy-match algorithms that find similar values.

High Level Flow Process

To get started, let’s say we have two lists of companies. One is a master list of companies that we want to use as our reference, or “golden” copy. The other is a list of companies that may be misspelled or unstandardized. We want to join these two lists together using fuzzy matching (although technically we employ fuzzy grouping options to enable traditional matching).

Within Tableau Prep I start with two groups of data, a clean “golden copy” of company names and a list of company names that contain poor data quality (i.e., user-entered data, which may have misspelled or unstandardized company names).

Once we have imported both data sets, we can append them using a union step. The union will combine the two lists of company names into one.

Next, we need to perform a fuzzy algorithm on the list of company names. Remember that both the golden copy and the misspelled names are stacked into one column. In Tableau Prep, we’ll use the fuzzy grouping capability to group together similar values, even if they’re not exact matches. We’ll use this technique to group the misspelled company names with their correct counterparts in the “golden” copy.

Granted this approach does not scale terribly well over a large dataset because we need to eyeball each grouping to ensure it is acceptable, but it is a good start. I don’t know of any fuzzy algorithm that guarantees 100% results, as “fuzzy” is inherent in the name of the approach.

Here are a couple of must read posts from the Tableau Knowledge Base for Fuzzy Grouping if you want to understand these automated grouping options:

After the values in the combined column are grouped together into a standardized clean format, we simply need to deduplicate our values so we are left with a 1 to 1 mapping between the incorrect data and the cleaned up result of the fuzzy grouping. We can use this “translation table” as a means to join our Golden Copy dataset to the less standardized dataset (which has the sales data we need to analyze).

Result

By using fuzzy match and Tableau Prep, I was able to successfully reconcile the variations in the company names and match the sales quotes in the “poor data quality” company names data set to their corresponding IDs in the clean golden copy names data set. If you’re stuck in this kind of a scenario at work, use this process to advocate for a cleanup of the data quality at the source of entry or creation.

In conclusion, fuzzy matching is a powerful technique that can help you match data even when the data may not be spelled correctly or may have slight variations. Tableau Prep may not have a straightforward fuzzy matching feature (a la Excel), but we can use fuzzy grouping to achieve similar results.

Here is a pic of the flow we build in the video. I add additional steps for this unique case but ideally to perform the fuzzy grouping we could stop much earlier in the process.

Additional “Fuzzy” Videos (Not Quality Wise, Topic Wise)

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please check out the logo shop here.

Stay in contact with me through my various social media presences.

Thank you!!

Anthony B Smoak

Remove the Default Highlighting Effect in Tableau

Have you ever wanted to disable the default Tableau highlighting effect when you select a mark on your chart and then remove the filter? Even when the filter is removed via the “Remove All Filters” process, it can be confusing for the user experience when all values remain “greyed out”, tricking the user into thinking that their filter is still applied. This video will help you remedy this issue and improve your dashboard user experience.

Fortunately, there is a solution to this problem that is simple and easy to implement. In this video I will show you how to use a simple calculated field and highlight action to remedy the issue. This should be default behavior in Tableau, (help us out here Tableau!)

The solution approach involves creating a boolean calculated field and setting it initially to TRUE. Then, placing this calculated field on the detail of the chart that has a filter applied. Next, adding a highlight action to the same chart that you want to remove the “greyed out” effect for. In the “Add Highlight Action” pop-up box, the Source Sheet and the Target Sheet should be the same and the Selected Fields option should have the boolean calculated field checked.

By following these steps, you will be able to remove the greyed out effect on your Tableau chart when the “Remove All Filters” process is applied.

This not only improves the appearance of your dashboard but also makes it easier to understand the data.

★☆★ THESE ADDITIONAL FILTERING VIDEOS IN TABLEAU ARE WORTH YOUR TIME ★☆★

Don’t let the greyed out effect on your Tableau charts hold you back any longer. Watch the video and follow the steps outlined in this blog post to improve the appearance and functionality of your Tableau dashboards.

You can also follow my dapper data adventures on Instagram.

Stay in contact with me through my various social media presences.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please check out the logo shop here.

Thank you!!

Anthony B Smoak

How I Passed the Tableau Certified Data Analyst Exam

I’m proud to announce that I recently passed the Tableau Certified Data Analyst certification. If you found this article, most likely you are looking for a perspective on the exam and how to pass and earn this certification yourself. Here is the story of my journey, which may differ from the typical experience.

I had a New Year’s resolution to add the Tableau Certified Data Analyst certification to my resume because the Tableau Desktop Certified Associate certification I held was due to expire.  If you want to read up on how I passed that older exam, you can find my insights here. Some of those insights will also serve you well on passing the current exam.

I believe that certification has its advantages. It’s a way to signal to potential and current employers that you have some defined level of competency in a targeted skill. It’s also a means to strengthen the case to your employer that you deserve additional compensation (if you are under-compensated). Fortunately, I am compensated fairly now, but this has not always been the case (shout-out to highly competent middle office IT pros toiling away underappreciated, but I digress). Finally, studying allows you to stay up-to-date on the latest tools and trends in your chosen domain.

How Much Experience Do You Need?

The official exam guide states, “The best preparation is role experience and time with the product. To be prepared, candidates are strongly encouraged to have at least 6 months of experience.” I would tend to agree with this if you have used the tool extensively during this time frame. Otherwise, I would recommend at least 1 to 2 years experience with the tool and as a data analyst before attempting to sit for this one. Focus on obtaining the Tableau Specialist certification (it never expires) first before attempting this exam.

Why Did I Get Certified?

For my purposes as a senior manager in a consulting practice, certification certainly has benefits with respect to establishing credibility quickly on new projects. I may hold a manager title but you’ll never pry my hands away from keyboard-centric hands-on technical work, as I enjoy being a technical subject matter expert (and teaching/mentoring others).

Other than employment and signaling purposes, an additional benefit of certification is the personal growth and esteem benefits that you gain from tackling a goal. My body of work is visible online and I have years of relevant experience, thus certification is not something I necessarily needed but something I desired.

The main difference between the new Certified Data Analyst exam and the older Desktop Certified Associate exam is that you will now be tested on Tableau Prep, Tableau Server and Tableau Online. Having to understand aspects of Server and Online were initial concerns I held before taking this test.

I have about 7 years of experience between Tableau Public & Desktop and about a year of experience with Tableau Prep so that was not an issue. I have used Tableau Server to publish my dashboards while on a project at a large Fortune 500 company, but I would by no means consider myself a server expert. I’ve used Prep to transform data for clients without issue as it is easy to pick up with exposure and usage. Look at this listing of domain items covered on the exam.

My strategy to compensate for a lack of deep hands on experience in Domain 4 was to perform really well on all the other domains. Using this strategy, I could still potentially score 91% max (assuming I miss every Domain 4 question which would be highly improbable). If you are like me and have deep knowledge of Tableau Desktop, then you should be fine. Do not use a lack of server experience as an excuse to avoid certification. Simply read up on publishing content at these links and you should have a fighting chance. Personally, I found the Certified Data Analyst exam to be somewhat easier than the Desktop Certified Associate exam. Not easy, just a little bit easier with respect to the Tableau Desktop asks.

This Tableau Prep link could prove useful as well:

Another difference between the Certified Data Analyst exam and the older Desktop Certified Associate exam is the presence of a hands-on lab portion. I honestly found this to be the easiest section on the test, although your mileage may vary. There was one question that had me stumped only because I wasn’t sure what was being asked so I built a visual that probably did not reflect the ask. Other than that 1 question, I felt that I nailed this section.

The official exam guide states, “Candidates are encouraged to comment on items in the exam. Feedback from all comments is considered when item performance is reviewed prior to the release of new versions of exam content.” In hindsight, I should have left a comment on the question stating “unclear”.

For the hands on lab (I’m not sharing anything that isn’t already on the exam guide), definitely be familiar with filter and highlight actions, how to use a TOP N filter, how to use parameters with filters, labels, and how to add reference lines and perform custom sorting.

How Did I Prepare?

Honestly, I meant to prepare for at least a week beforehand, but life got in the way. Thus, I literally crammed my review into the span of 7 hours the Saturday before sitting the exam. I do not recommend this if you are not well versed in the tool. I simply needed to review some concepts. The listing at this website provides great links to official Tableau documentation for the subject areas covered on the exam.

Results

I completed the exam with about 35 minutes to spare. After I submitted my results online, I only had to wait an hour before I received an email stating that I had a score available. This is in stark contrast to when the beta exam was in effect. I heard that results would take months to process. I cleared the 75% hurdle despite studying for only a few hours and not having deep experience with Tableau server. I could have easily scored higher given more study time, but I was happy to pass the exam given the meager study time I allotted to the task. I’m not saying that the test was easy, I’m just fortunate that I’ve had enough experience with Desktop that I could “sacrifice” in other areas and still make it across the finish line. This strategy may not work for you if you have under a year’s experience with the tool.

Focus on These Subject Areas:

However, here is the section you came for, this is my abridged list of test focus areas. Make sure to focus on these subject areas to give yourself a good shot at passing the exam.

Start here: Here are 5 useful videos from my catalog that you should review to level up for the exam. I promise they are worth your time and will help you prepare. Do me a favor and like the videos to help others find the content as well!

I used this link to acquire access to a free practice exam: https://savvy-data-science.ck.page/1ec0f2d5a8

Additionally focus on these areas from the exam study guide:

  • INDEX function
  • Parameters
  • TOP N Filter
  • Context Filters / Data Source Filters
  • DENSERANK
  • Exporting Options
  • Sets
  • Extracts
  • DATETRUNC, DATEPART, DATENAME
  • Map Density
  • Percent Difference
  • Know How to Interpret a Box-Plot
  • Know How to Build Dual Axis Charts
  • Understand FIXED LODs
  • Understand TOTAL vs SUM
  • Understand Hierarchies
  • Understand Show Hide Container Functionality
  • Design for Mobile Layouts
  • Blending Data
  • Know How to Add Totals to Charts
  • SPLIT Function
  • Row Level Shading

Also follow Jared Flores as he has a great YouTube channel focused on Tableau Prep.

Best of luck to you. I know that you can pass this test if you have decent hands on experience with the tool. For those of you without a Tableau license, use Tableau Public to study and fill in gaps by reading blogs, watching videos and using Tableau official documentation. I believe in you!

Need Personal Data Tutoring?

Are you a beginner that needs help understanding data topics in Tableau (or Excel/SQL) and would like someone with experience to discuss your problem? If so, contact me here to schedule a 1 on 1 virtual meetup. Make sure to describe the concept that you are trying to learn in the message so I can understand if I can help. Depending upon your ask and time required we can discuss cost. Access to Tableau Public will cover most of your study needs regarding the Tableau Desktop sections and lucky for you, that is a FREE tool.

About Me (Data background):

  • Experience: 15 Years Industry + 8 Years Analytics Consulting
  • Tableau Certified Data Analyst
  • 2X Tableau Ambassador
  • MBA – Georgia Institute of Technology
  • M.S. Information Management – Syracuse University
  • B.S. Computer Science – Clark Atlanta University
  • Certified Business Intelligence Professional
  • YouTube 2.5 Million Views on my Analytics Channel

Image :@anthonysmoakdata (Instagram)

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please check out the logo shop here.

Thank you!!

Anthony B Smoak

How to Swap Sheets in Tableau

Learn how to perform a useful Tableau hack that allows you to display multiple sheets in one container on your Tableau dashboard. In this video I use my personal training dashboard to show you step by step how this trick is performed. This tip is a must know for the intermediate to advanced dashboard builder as it will help you save space on your dashboard.

Learn more about the dashboard used in this video: https://youtu.be/MFluvSKJXnI

Interact with the Dashboard here:

Watching the video will make the concept clearer but I will provide an overview in this post.

Step 1: I create a Parameter named “Select a Chart”. You can see that I have chosen a list of allowable values and I place into the list the names of charts that I want to swap.

Step 2: I create a calculated field named “_Selected Chart”. It only holds the value of the parameter I created in Step 1.

Step 3: (Use screenshot below)

1. Place the “_Selected Chart” calculated field on the filter shelf of a chart that you wish to show and hide.

2. Edit the “_Selected Chart” filter and select the “Custom value list” option.

3. Type in the respective name of the chart that corresponds to the value that you entered in the parameters allowable values list in Step 1. Hit the plus button to the far right to add the value. Additionally add the value of “All” to the Custom value list in the same manner.

IMPORTANT: the value that you enter into your chart must match EXACTLY to the value that you placed on the parameter allowable values list.

Repeat this process for every chart that you wish to show and hide, making sure to type in the exact same chart name that you entered in the parameter allowable values list in Step 1.

Step 4:

Now it’s time to place all of your charts into the same object (i.e., horizontal or vertical container) on your dashboard . Make sure to show the parameter named “Select a Chart” on the dashboard so you have a combo box with the names of your charts inside that you can select.

Make sure to watch the video for exact details!!

Please like and subscribe on the Anthony B. Smoak YouTube channel.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please click here

Thank you!!

Anthony B Smoak

Build Better Sparklines in Tableau

So you want to add some spice to your bland looking Sparklines in Tableau? You have come to the right place (start by watching the video above). Let’s talk about how a Sparkline is defined per Wikipedia:

“A sparkline is a very small line chart, typically drawn without axes or coordinates. It presents the general shape of the variation (typically over time) in some measurement, such as temperature or stock market price, in a simple and highly condensed way. Sparklines are small enough to be embedded in text, or several sparklines may be grouped together as elements of a small multiple. Whereas the typical chart is designed to show as much data as possible, and is set off from the flow of text, sparklines are intended to be succinct, memorable, and located where they are discussed.”

Here are a few examples of Tableau specific sparklines in action (with latest complete month bubble indicators and reference lines): Notice how I do not include any data axes, but you can clearly recognize the data trends in the visuals.

Here is an example of how I used the sparklines demonstrated in the video to build a out a classic yet refined looking Tableau dashboard.

Interact with and download this workbook here.

For reference purposes I am going to list three formulas used in the completion of the sparklines, you’ll have to watch the video to learn how to put them together.

In this exercise I am using that standard Tableau Superstore data set which you can perform a Google search to find if you are using Tableau Public.

Calculated Fields

Calculated Field #1 (Name: SPRK_CircleMonths)

This calculated field puts a circle on the penultimate month data points. Penultimate is just a fancy SAT word way of saying “next to last”. When the month of the data point on the line chart (Order Date) equals the next to last order date month in the dataset, then return the Order Date.

//IF THE MONTH OF THE DATE ON THE LINE CHART EQUALS THE MONTH-1 OF THE MAXIMUM DATA POINT
// THEN RETURN THE DATE
If DATEPART('month',[Order Date]) = DATEPART('month',dateadd('month',-1,{MAX([Order Date])}))
Then [Order Date] END

Calculated Field #2 (Name: SPRK_CircleMonths)

This logic will be applied to the circles generated by the previous calculation SPRK_CircleMonths. Only the next to last month will meet the TRUE condition (which will be colored as red).

// IS THE MONTH OF THE CHART DATE EQUAL TO THE MOST RECENT DATE MONTH MINUS 1 MONTH
// E.G., NOV 2018 = NOV 2020 WILL RESOLVE TO TRUE DUE TO MATCHING MONTHS
DATETRUNC('month',[Order Date]) = DATEADD('month',-1,DATETRUNC('month',{max([Order Date])}))

Calculated Field #3 (Name: SPRK_RefLine Profit)

This logic will return the profit associated with the next to last month in the dataset to display on the reference line.

// RETURNS A VALUE USED FOR THE REFERENCE LINE
// IF THE MONTH OF THE DATE = THE MONTH OF THE MAXIMUM DATE MINUS 1 MONTH (GET A COMPLETE FIRST MONTH)
if DATETRUNC('month',[Order Date]) 
= DATEADD('month',-1,DATETRUNC('month',{max([Order Date])}))
THEN [Profit] END

When you put all the functions together in a manner according to the video, you end up with a more refined sparkline in my opinion. Big shoutout to the Data Duo for the inspiration on the dashboard I created and this technique. If you haven’t checked out any of their work make sure to do so.

Please like and subscribe on the Anthony B. Smoak YouTube channel.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please click here

Thank you!!

Anthony B Smoak

Top 10 Functions in Tableau You Need to Know

Welcome Tableau learner!

Normally my videos are geared towards the intermediate level user in Tableau but in this post I want to share a video I recorded that tackles basic functions in Tableau that you should know. You will NOT be effective analyzing data in Tableau if you do not have a basic understanding of these functions.

I love to use data from basketball-reference.com in my videos. Specifically you can grab the player statistics I am using in the video here.

This video is so good, it received a mention in the Monthly Tableau roundup. See for yourself!

Also, here is a link to all of the Tableau functions from the knowledge base.

Please make sure to share this link with a new Tableau user in your circle and let me know what you think of the videos in the YouTube comment section.

Please like and subscribe on the Anthony B. Smoak YouTube channel.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please click here

Thank you!!

Anthony B Smoak

Tableau Tile Map Data Project

I was recently inspired by some really great tile-maps that have been created in the Tableau community (e.g., see beautiful work by Chimdi Nwosu and Michael Dunphy). Thus, you know I had to come up with a way to construct a simplified map in this style with some data and share with my followers. In these two videos, I’m going to walk you through how to prepare the necessary data file in Tableau Prep Builder and then we’ll build out the tile-map in the second video, step by step.

This is a good intermediate level portfolio project for you to follow along with in order to increase your Tableau Desktop and Tableau Prep skills. We’ll use CDC data, specifically United States COVID-19 Cases and Deaths by State over Time, to build the tile-map.

The advantage of a tile-map is that it represents geographic regions (like states) at equal sizes. Thus, the distortions and biases introduced by differences in sizes are eliminated. In the case of the United States, data for smaller regions like Washington D.C. can be interpreted on equal footing with data for a much larger region like California.

Tableau Prep Builder helps to greatly simply the data shaping process. My only wish is that Tableau would integrate Prep into Tableau Desktop for one seamless data tool to rule them all, but I digress. The process below illustrates how simple it is take some data from an input file, and subsequently clean and pivot the data into a new file. Watch the first video, to learn how to build out this simple flow in Tableau Prep. If you do not have a copy of Tableau Prep, you can complete this lesson on a 14 day trial license of the tool, which you can download here.

Watch the second video for the step by step instructions to build out the tile-map above.

Please like and subscribe on the Anthony B. Smoak YouTube channel.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please click here

Thank you!!

Anthony B Smoak

Filter Tableau Data By Wildcard Search With Multiple Keywords

In this video I will teach you how to perform a multiple keyword search in Tableau. I’ll show you how to perform both an OR search & an AND search against keywords you type into your dashboard parameter.

In order to accomplish these tasks, we need to use regular expressions. As I mention in the video, regular expressions can be indecipherable, akin to hieroglyphics or something out of a Dan Brown novel to the average person. You can go find this information on the Tableau knowledge base, but I want you to be the person that understands WHY something works as opposed to just copying and pasting a solution that you cannot explain to yourself or others.

The use case for multiple keyword search is for those times when you need to filter your data by a comment, description or other free form blocks of text that are not necessarily subject to the most stringent data governance rules, because let’s face it, these types of fields exist in abundance. In the video I create a dashboard that illustrates the power that this type of search can bring to your dashboard.

You can interact with the dashboard from the video on my Tableau Public page.

OR SEARCH

1. CREATE PARAMETER

Create a parameter named Search Terms.

  • Data type: String
  • Current value: keep it blank.
  • Allowable values: All

2. CREATE CALCULATED FIELD 1

Create a calculated field named Regex String (OR) including the following formula:

"(" + REPLACE([Search Terms], ',' ,'|') + ")"

Let’s breakdown what is going on with the apparent gibberish seen above (there is a method to the madness here). I’ll assume you want to perform a search against a field that contains the terms “paper” OR “Paper”; the case of the spelling is a factor in the results (case sensitive). To adhere to proper regex formatting, you could write a valid expression as such:

(paper|Paper)

This pattern indicates that you want to return a match on the characters “paper” OR “Paper” literally. You can test this out at https://regex101.com/

Although for some reason the official Tableau knowledge base article says to use the REGEX_REPLACE formula in lieu of REGEX, it is not needed since we are doing a simple replace and not using a regex formula to aid our replacements.

In the Tableau calculated field above, we are using the REPLACE function against the parameter named “[Search Terms]” to replace every instance of a comma with the the ‘|’ pipe symbol.

Think about it, if you type the terms “paper, Paper” into the a dashboard’s search term parameter as seen below, the calculated field will reformat your list into the proper regex format by replacing the comma with a pipe and then enclosing the term within parenthesis; i.e., (paper|Paper).

3. CREATE CALCULATED FIELD 2

Next create a calculated field named Regex OR Filter that contains the following formula:

REGEXP_MATCH([Product Name],[Regex String (OR)])

Let’s breakdown what is going on with the formula seen above. The REGEXP_MATCH formula is evaluating a properly formatted regex expression which is contained within the [Regex String (OR)] calculated field we created in step 2. This calculated field will contain the formatted expression (paper|Paper).

REGEXP_MATCH returns TRUE if a substring of the specified string matches the regex pattern. In our case

[Regex String (OR)] = (paper|Paper)


Thus the REGEXP_MATCH function will evaluate the regex expression (paper|Paper) from the second argument against the [Product Name] field in the first argument. The function will return either TRUE or FALSE depending upon whether a match is located within this field.

3. DRAG FIELDS TO ROWS AND FILTERS SHELF

Place [Product Name] to rows and [Regex OR Filter] to filters, then select True.

AND SEARCH

In order to create the AND search for your dashboard, you will follow very similar steps to the OR search. 1. Create the same parameter named Search Terms as in the OR Search above.

2. CREATE CALCULATED FIELD 1

Next create a calculated field named Regex AND Filter including the following formula:

"(?=.*" + REPLACE([Search Terms], ',' ,")(?=.*") + ").*"

This may look like something out of a Dan Brown novel, but don’t let it intimidate you. In a similar fashion to the OR search where we replaced commas with a pipe symbol, we are simply replacing commas with the following characters between the double quotes “)(?=.*”

The proper regex pattern to indicate an AND search against the terms paper and Paper within a body of text would be as such:

(?=.paper)(?=.Paper).*

Knowing the proper regex format should make the contents of the calculated field above more clear. We are using the REPLACE function against the parameter named [Search Terms] to replace every instance of a comma with the the )(?=.*symbols. Thus “Paper, paper” values typed into the [Search Terms] parameter becomes reformatted into(?=.paper)(?=.Paper).*

Placing .* at the end of the string means that any combination of characters can be placed after the search terms and still yield a TRUE result.

3. CREATE CALCULATED FIELD 2

Next create a calculated field named Regex AND Filter including the following formula:

REGEXP_MATCH([Product Name],[Regex String (AND)])

4. DRAG FIELDS TO ROWS AND FILTERS SHELF

Then place [Product Name] to rows and [Regex OR Filter] to filters, then select True.

CONCLUSION

That wasn’t so horrible was it? If you’re a visual learner like me, then go ahead and watch the video to hammer home the concepts. Hopefully this post will help you understand how these regex patterns work and how they can add value to your next dashboard design! As always if you learned something drop a comment on the YouTube video and let me know.

Please like and subscribe on the Anthony B. Smoak YouTube channel.

All views and opinions are solely my own and do not necessarily reflect those of my employer

I appreciate everyone who has supported this blog and my YouTube channel via merch. Please click here

Thank you!!

Anthony B Smoak

TLDR: Tableau Knowledge Base Reference: https://kb.tableau.com/articles/howto/how-to-filter-data-by-wildcard-search-with-multiple-keywords