All in Tableau Calculations

Do you need to publish public Tableau reports but suppress small populations because of sensitivity concerns?

If you work in healthcare, education or another government entity, there's a good chance your Tableau reports contain sensitive information that needs to be suppressed. For example, many organizations we work with need to suppress populations when they are less than five. For example, if we filtered a courts dashboards to see how many court cases there were in Whatcom county for 12-14 year old, Pacific Islander females in 2017 and there were three cases, we would need to suppress that figure because it's less than five.

Text tables can be overwhelming for users. It's hard to know where to focus your attention!

Where are the highest and lowest values in the data? What patterns are there? Upgrading a text table to a highlight table can often do wonders, but a highlight table doesn't provide a singular focus. It will likely highlight high, and maybe low values too.

That's where a custom highlighter can be so handy. Why not let you user control which values they want to call attention to?

Normally, when using a parameter to swap between measures, you're limited to using a single number format in a text table. But what happens when using the same number format makes no sense?

In our example, we're swapping between Total Cost (reported in $) and Visits (a count). We don't want to report Visits as a dollar-denominated amount, and we don't want Total Cost to be reported without a dollar symbol! So what can we do?

Have you ever seen the error: “Cannot mix aggregate and non-aggregate arguments in this function?” If you’ve worked with Tableau for any period of time, you probably have! You could have seen this in an IF statement, a CASE statement, or just a regular calculation!

The big idea is that we can’t aggregate part of our calculated field while not aggregating another part of the same calculated field.

This is because aggregated functions run at a "summary" level, while a non-aggregated function runs at a “row by row” level. So, when we try to use these in one function, Tableau gets confused at exactly how to execute what we’re asking!

In Excel, we can use Text to Columns to split a string. But what about in Tableau?

Tableau has a built-in function called SPLIT() that allows us to split strings into multiple columns. We’ll take a look at how to indicate to Tableau the number of columns we want to see and how to understand where to split the string.

Want to see how to split names, email address or phone numbers to isolate the meaningful information from the text string? Check out these examples!

Do you want to use Tableau to look at running headcount over time? For example, you work with employee level data which has Start Dates and End Dates and you'd like to be able to see how the total active headcount at the company has changed over the last 8 quarters.

That's something Tableau can do, but it isn't going to work out of the box. It's going to take some creative data structuring and calculations to get things working.

Do you ever have a data set with US State names and it would be really handy to save some space in your visualizations by displaying state abbreviations instead of full state names? Or how about a situation where you want to display country abbreviations instead of the full country name? This happens to me often!

It feels like every year or two I run across a need for this and end up writing the same calculation from scratch over and over again. No more! This video shows how to write calculations which convert state and country names to their abbreviations and provides a Tableau Workbook with the calculations you can copy and paste and never have to write them from scratch again!

Does your data set have multiple date fields? For instance, maybe you have both an "Order Date" and a "Delivery Date". Or maybe you have both a "Hire Date" and a "Termination Date".

Sometimes, you need to filter on both date fields at once to answer questions like, "How many people were hired and how many people were terminated in the Marketing Department this year?"

Sometimes, you have too many values in a dimension on the rows shelf in your Tableau worksheet and end up with a scroll bar. Annoying, right? Scroll bars mean your users are less likely to see the data at the bottom of your worksheet because it it out of sight and out of mind.

One idea I've heard discussed is, what if you could break the data into multiple columns? For example, instead of displaying 50 states as a single column of 50 rows, could you display it at 2 columns or 25 rows?

Many organizations report against a fiscal calendar. If your organization's fiscal year doesn't start in January and you've tried to display values against fiscal periods in Tableau, you probably know exactly what I'm talking about.

When fiscal date periods are being compared, it's usually Fiscal Years or Fiscal Quarters. Let's imagine you are asked to build a chart which compares business segment values from the current Fiscal Quarter to Date versus the same period last year. Where would you start?