Table Calculation Functions in Tableau - Understand with Examples

This guide will help you understand the Table calculation functions in Tableau with the help of a video tutorial and examples

You've landed in the right place if you're a data enthusiast, analyst, or professional seeking to master data visualization and analysis skills. Tableau's robust suite of Table Calculation Functions helps users perform complex calculations, comparisons, and aggregations directly within their visualizations, unlocking deeper insights and facilitating more informed decision-making. This guide will help you understand the essential Tableau calculation functions with practical examples. So, let’s get started! 

What are Tableau Calculation Functions in Tableau? 

Table Calculation Functions in Tableau enable users to compute values based on data in the visualization. They operate on aggregated data, making it possible to perform calculations like running totals, moving averages, percent of total, and more. These functions are dynamic and respond to changes in the visualization, ensuring that calculations are updated in real time as filters or selections are applied. 

 

Key Table Calculation Functions - 

  1. Running Total: Calculates a running total of the values in a specified field.

  2. Percent of Total: Computes the percentage contribution of each value to the total.

  3. Difference: Calculates the difference between consecutive values.

  4. Moving Average: Computes an average of a specified number of previous and subsequent values.

  5. Rank: Assigns a rank to each value based on a specified order.

Custom Table Calculations in Tableau 

Tableau also offers the flexibility to create calculated fields, helping users define custom calculations using a variety of functions, including Table Calculation Functions. Users can extend Tableau's analytical capabilities and derive deeper insights from their data by incorporating Table Calculation Functions within calculated fields. Check out the video below to deepen your understanding -

 

Table Calculation Functions in Tableau With Examples

Let’s take a look at a few Table Calculation Functions along with examples:

 

  1. LOOKUP 

Retrieves the value of a specified field from a row at a relative offset.

Example: Compare sales this month with sales from the same month last year.

 

LOOKUP(SUM([Sales]), -12)

 

  1. WINDOW_SUM

This function calculates a sum across a specified range of data points.

Example: Calculate a moving average of sales over three months.

 

WINDOW_SUM(SUM([Sales]), -2, 0) / 3

 

  1. WINDOW_AVG

Calculates the average of values within a specified window.

Example: Calculate a 3-month moving average of profit.

 

WINDOW_AVG(SUM([Profit]), -2, 0)

 

  1. WINDOW_MAX/WINDOW_MIN

Finds the maximum/minimum value within a specified window.

Example: Identify the maximum monthly sales within a year.

 

WINDOW_MAX(SUM([Sales]), 0, 0)

 

  1. WINDOW_COUNT

Counts the number of data points within a specified window.

Example: Count the number of orders placed in the current month.

 

WINDOW_COUNT(ATTR([Order ID]))

 

  1. RUNNING_SUM/RUNNING_AVG

Calculates a running sum or average of values as they are encountered in the data.

Example: Calculate cumulative profit over time.

 

RUNNING_SUM(SUM([Profit]))

 

  1. WINDOW_MIN()

Calculates the minimum value across a specified range of rows in the current partition.

Example: Find the minimum inventory level in the past 10 days.

 

WINDOW_MIN(MIN([InventoryLevel]), -9, 0)

 

  1. PREVIOUS_VALUE()

Returns the value of an expression from the previous row.

Example: Calculate the difference in sales between the current month and the previous month.

 

SUM([Sales]) - PREVIOUS_VALUE(SUM([Sales]))

 

Master Tableau Operations with ProjectPro! 

Learning about Table Calculation Functions in Tableau is essential for visualizing data. But just reading about them isn't enough. You have to practice with real-world projects to get good at it. That's where ProjectPro comes in. It's like a vast repository of industry-grade projects that you can work on. By doing these projects, you'll understand Tableau better and become a pro at making excellent data visuals. So, while this blog gives you a good start, the real fun and learning happen when you start working on projects. Check out ProjectPro today to become a Tableau expert.  

What Users are saying..

profile image

Ameeruddin Mohammed

ETL (Abintio) developer at IBM
linkedin profile url

I come from a background in Marketing and Analytics and when I developed an interest in Machine Learning algorithms, I did multiple in-class courses from reputed institutions though I got good... Read More

Relevant Projects

Skip Gram Model Python Implementation for Word Embeddings
Skip-Gram Model word2vec Example -Learn how to implement the skip gram algorithm in NLP for word embeddings on a set of documents.

AWS MLOps Project for ARCH and GARCH Time Series Models
Build and deploy ARCH and GARCH time series forecasting models in Python on AWS .

Recommender System Machine Learning Project for Beginners-4
Collaborative Filtering Recommender System Project - Comparison of different model based and memory based methods to build recommendation system using collaborative filtering.

Build a Face Recognition System in Python using FaceNet
In this deep learning project, you will build your own face recognition system in Python using OpenCV and FaceNet by extracting features from an image of a person's face.

Build a Text Generator Model using Amazon SageMaker
In this Deep Learning Project, you will train a Text Generator Model on Amazon Reviews Dataset using LSTM Algorithm in PyTorch and deploy it on Amazon SageMaker.

Time Series Forecasting Project-Building ARIMA Model in Python
Build a time series ARIMA model in Python to forecast the use of arrival rate density to support staffing decisions at call centres.

GCP MLOps Project to Deploy ARIMA Model using uWSGI Flask
Build an end-to-end MLOps Pipeline to deploy a Time Series ARIMA Model on GCP using uWSGI and Flask

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

Avocado Machine Learning Project Python for Price Prediction
In this ML Project, you will use the Avocado dataset to build a machine learning model to predict the average price of avocado which is continuous in nature based on region and varieties of avocado.