All in Tableau Calculations

When you have a worksheet with many values, one of the best ways to present it to your user is to filter on the most relevant values. Those will often be the highest or lowest values. Tableau has a built in dimension filter which allows you to pick the top (or bottom) number of values you would like to display (e.g. Top 10).

You know what Tableau doesn't have out of the box? The ability to select the top *percent* of values to filter on. Don't sweat it though, because we've got you covered! With a parameter, calculation and filter application, we can filter on a top percent of values and give end users the options to change the top percent of values being displayed.

Groups are an incredible feature in Tableau, but they are limited. For instance, you can’t leverage a group for a blend or cross-database join.

If you need to use the output of a group for data preparation, you will probably want to turn it into a calculated field. Rather than doing it slowly by hand, why not leverage a quick calculation which can speed up the process?

Check out the video below to learn how you can easily turn a group into a calculated field in Tableau.

Dealing with nulls in Tableau calculations requires a bit of specialized product knowledge. For instance you can’t write IF [Dimension] = NULL THEN “X” END. If you want to reference a null value, you need to use ISNULL. If you want to replace a null value with another value, you can use IFNULL. If you want to replace all nulls with zero, you can use ZN. Check out the video below to learn how these functions work and learn which kinds of use cases they are most helpful for.

A student in one of my Tableau classes recently told me they were searching for a solution to one of their problems and came across my blog post Month to Date vs. Previous Month to Date in Tableau. Score!

I asked if it solved his problem and he mentioned that his use case was slightly different. Instead of answering the question, “How do month to date sales compare to previous month to date?” he was trying to answer, “How do month to date sales compare to month to date sales for each month from the past year?”

Tableau is optimized to perform date comparisons and calculations relative to a standard calendar. If your organization’s year starts on the first of a month other than January, Tableau can still handle that relatively well. The flexibility breaks down when the calendar year doesn't start on the first of the month and the comparison periods (e.g. semester or trimester) don't align with Tableau's pre-built periods (quarters, months, weeks).