MIP Logo

5 Calculated Field Formulas for Data Viz Success

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here

One fabulous feature of Tableau is the ability to create calculated fields. I am learning to love what you can do with them. Once you have a few under your belt, you can use calculated fields to create new formulas that allow you to manipulate your data. In this blog post, I’ll explore five calculated fields in Tableau that really make a difference.

Percentage of Total

Percentage of Total is an effective way to visualise the proportion of a particular value relative to the total. To create a Percentage of Total calculated field, divide the value you’re interested in by the total and make your result a percentage. Your formula might look something like this:

SUM([Value you’re interested in])/SUM([Total value])*100

MakePoint

The Makepoint function creates a geographic point object from latitude and longitude values. To use this function, create a calculated field that combines the latitude and longitude fields in your data source using Makepoint:

Makepoint (Latitude, Longitude)

This creates a point object for each latitude and longitude pair, which you can then use to add the data on your map as a point.

If Then

Personally, my favourite function. The IF/THEN function allows you to perform different calculations based on conditions you set. If you wanted to create a calculated field that classifies number of bike rides as “High” or “Low” based on a particular value, your formula might look something like this:

IF [Bike rides] > 10000 THEN ‘High’ ELSE ‘Low’ END

You can also use the IF/THEN function with multiple conditions by using AND or OR. This can make your formula quite long!

Trim

The TRIM function in Tableau removes leading and trailing spaces from a string.
It’ll look like this: TRIM(string)

Right and Left

This returns either the left or right characters of a string. It comes in handy if you need to remove characters, so if you wanted to remove the last 3 characters from a string, you might use the RIGHT function with the LEN function to determine the length of the string.

For example, if you have a field that has unnecessary code in the last three characters, you can create a new field that removes these three characters using the following formula:

RIGHT([Product Code], LEN([Product Code]) – 3)

The RIGHT function in Tableau counts from the end of a string. The LEFT function counts from the start of a string.

If you want to only take the last 5 characters from something like “I’m thinkin’ I’m back!” (John Wick stans will get it), you would use the formula: RIGHT(“I’m thinkn’ I’m back”, 5).

This would return the string “back!”

I hope this has inspired you to use new (or revisit old) calculated fields in your Tableau visualisations.

 

Share this post