All in Tableau Calculations

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).

Sometimes, when analyzing your business, you want to know how values month to date compare to this same point last month. We wrote a post about how to write these calculations in Tableau a while ago, but we’ve updated our methods and have some simpler formulas now! Check out the video below to learn the simplest way to write Month to Date and Previous Month to Date formulas.