top of page

Welcome
to NumpyNinja Blogs

NumpyNinja: Blogs. Demystifying Tech,

One Blog at a Time.
Millions of views. 

Understanding Calculated Fields vs. Table Calculation in Tableau

Updated: Jun 24

Tableau is a powerful data visualization and analytics platform that helps people see and understand their data. It allows users to connect to various data sources, analyze data through an intuitive drag-and-drop interface, and create interactive dashboards, charts, and reports.

Two commonly used features in Tableau are Calculated Fields and Table Calculations. While both allow the creation of custom computations, they serve different purposes and are applied at different stages in the data pipeline. Let's dive into it.


What is a Calculated Field?

A Calculated Field in Tableau is a custom field you create by writing a formula using existing fields in your dataset. It is used to generate new data at the data source or row level, perform custom logic, or apply transformations that aren't part of your original data. Once created, it behaves like any other field—either a dimension (descriptive data) or a measure  (numeric data).


Why Use Calculated Fields?

  • Create new metrics and dimensions: Define custom measures or categorize data in new ways.

  • Perform data transformations: Clean, reshape, or modify your data.

  • Add conditional logic: Implement if/then statements for dynamic calculations.

  • Reusable across workbooks: Once created, they can be used in multiple sheets and dashboards.

  • Enhance analysis and insights: Uncover deeper patterns and relationships in your data.

  • Optimize performance: Pre-calculate complex logic at the data source level.


How to Create a Calculated Field:

  • Open a worksheet in Tableau.

  • Go to Analysis in the top menu and select Create Calculated Field (Alternatively, click the dropdown arrow next to "Data" in the Data pane and choose Create Calculated Field).

  • In the calculation editor that appears, give your calculated field a descriptive name.

  • Enter your formula using existing fields, functions, and operators.

  • When you're finished, click OK. The new calculated field will appear in your Data pane, ready for use in your visualizations.

    This video shows you how to create a calculated field on your existing data

Types of Calculations for Calculated Fields:

You can create calculated fields using different types of calculations, each suited for varying levels of granularity and complexity:

  1. Basic Calculations

  2. LOD Expressions

  3. Table Calculations


Basic Calculations

Basic calculations transform values either at the original data source level of detail (row-level) or at the visualization's aggregated level of detail.

  • Row-level calculation: The formula is applied to each individual row of your data before any aggregation (like SUM or AVG) occurs.

    Learn how to apply simple calculation to each individual row in your dataset
  • Aggregate calculation: Tableau combines multiple rows of data into a single summarized value before applying the calculation.

    Discover how to summarize your data using aggregate functions
LOD (Level of Detail) Expressions

LOD Expressions give you precise control over the level of granularity at which a calculation is performed, regardless of the dimensions in your view. They can compute values at:

  • An entirely independent level from the view (FIXED).

  • A more granular level than the view (INCLUDE).

  • A less granular level than the view (EXCLUDE).


  • FIXED LOD :

    FIXED LOD compute values using the specified dimensions without reference to the view's level of detail—that is, regardless of other dimensions in the view. They ignore all filters in the view other than context filters, data source filters, and extract filters.

Example : { FIXED [Category] : SUM([Sales]) }
This video explains how to use FIXED LOD to aggregate data at a specific, fixed level
  • INCLUDE LOD :

    INCLUDE LOD compute values using the specified dimensions in addition to the dimensions are in the view. They are most useful when including a dimension that isn't in the view.

Example : { INCLUDE [Segment] : AVG([Sales]) }
See how INCLUDE LOD allow you to bring in a finer level of detail to your aggregated view
  • EXCLUDE LOD :

    EXCLUDE LOD explicitly remove dimensions from the expression—that is, they subtract dimensions from the view's level of detail. They are most useful for eliminating a dimension already in the view.

Example : { EXCLUDE [Region] : SUM([Sales]) }
Understand how EXCLUDE LOD help you remove certain dimension from your aggregation's context

What is a Table Calculation?

A Table Calculation is a dynamic, view-level formula that transforms already aggregated data. It's used to perform post-aggregation computations like running totals, ranks, percent changes, and moving averages. Table Calculations operate within the context of the visualization and use only the data displayed in the worksheet.


Why Use Table Calculations?

  • Analyze trends or changes over time: Such as running totals or moving averages.

  • Perform ranking and sorting: Like ranking items based on a measure.

  • Compare values within the view: Such as comparing a value to a previous period using LOOKUP.

  • Calculate percent of total: Determine each part's contribution to the whole.

  • Stay in the view: No need to modify the underlying data source.

  • Quick table calculations for speed: Apply common calculations with just a few clicks.


Understanding Addressing and Partitioning:

The core of understanding table calculations lies in addressing and partitioning. These concepts define how the calculation moves through your data and are crucial for getting accurate results.

  • Partitioning Fields: These are the dimensions that break up the data into separate groups or panes for the calculation. The calculation restarts for each new partition.

  • Addressing Fields: These are the dimensions that define the order and direction of the calculation within each partition. The calculation moves along these fields.


Ways to Use Table Calculations

Table calculations can be performed using Quick Table Calculations or by manually adding a Table Calculation. Both methods help perform post-aggregation computations directly in the view. These calculations are dynamic and depend on how your data is laid out in the visualization.


1. Quick Table Calculations

These are pre-built table calculations you can apply with just a few clicks. Simply right-click on a measure in your view, hover over Quick Table Calculation, and select the desired type.

Common Quick Table Calculations

Name

What It Does

Running Total

Cumulative sum across rows/columns

Difference

Calculates the difference between current and previous row

Percent Difference

Difference as a percentage

Percent of Total

Share of the total

Rank

Ranks data based on a measure

Moving Average

Average over a rolling window

YTD Total

Sum of values from start of year to current period

Compound Growth Rate

Growth rate over multiple periods

Get a quick overview of how to apply common, pre-built calculations directly to your tables

2. Add Table Calculations

When you add a table calculation in Tableau, the "Add Table Calculation" dialog box (or "Edit Table Calculation" if you're modifying an existing one) is where you define how that calculation behaves. The two most critical sections in this dialog are "Calculation Type" and "Compute Using".


  • Calculation Type: This section determines what kind of mathematical operation or transformation the table calculation will perform. It's essentially choosing the "formula" for your table calculation. Its calculation types are similar to quick table calculation types like running total, difference, etc.

  • Compute Using: Defines the scope (partitioning) and direction (addressing) of the calculation. It tells Tableau which data points to include in the calculation and in what order to perform the calculation.

    Compute Using Options

Option

Description

Table (Across)

Calculates left to right across the table (columns)

Table (Down)

Calculates top to bottom down the table (rows)

Table (Across Then Down)

Left to right across rows, then moves to the next row group

Table (Down Then Across)

Top to bottom in columns, then moves to the next column group

Pane (Across)

Left to right within a single pane

Pane (Down)

Top to bottom within a single pane

Pane (Across Then Down)

Like Table (Across Then Down), but resets per pane

Pane (Down Then Across)

Like Table (Down Then Across), but resets per pane

Cell

Treats each cell independently; usually returns the same value as source

Specific Dimensions

Lets you manually pick fields for addressing and partitioning

Learn how to customize and add specific table calculations to analyze your data within the context of your view.

Final Thoughts:

  • Use Calculated Fields when you need to create new data points, transform existing data, or apply complex logic that becomes part of your underlying data model and is reusable across your workbook. They are ideal for foundational data preparation and deep, reusable transformations.

  • Use Table Calculations when you need dynamic, view-dependent calculations that perform post-aggregation analysis (like running totals, ranks, or percent changes) directly within the context of your visualization. They are perfect for in-the-moment analytical insights tied to your specific view.

By understanding these distinctions and knowing when to apply each, you'll unlock the full analytical power of Tableau and gain deeper insights from your data.

+1 (302) 200-8320

NumPy_Ninja_Logo (1).png

Numpy Ninja Inc. 8 The Grn Ste A Dover, DE 19901

© Copyright 2025 by Numpy Ninja Inc.

  • Twitter
  • LinkedIn
bottom of page