← Back to Blog

Understanding Calculated Fields in Tableau

by Rebecca Bergh
TableauFormulasTutorial

What Are Calculated Fields?

Calculated fields in Tableau allow you to create new fields using formulas based on existing data. They’re a powerful way to extend your analysis without modifying the underlying data source.

Example Formulas

Here are some common calculated fields you might use:

Profit Ratio
[Profit] / [Sales]
Sales by Year
YEAR([Order Date])
High Value Order
IF [Sales] > 1000 THEN "Yes" ELSE "No" END
Running Total
RUNNING_SUM(SUM([Sales]))

Creating Your First Calculated Field

To create a calculated field in Tableau:

  1. Click Analysis on the top menu bar, then select Create Calculated Field…
    • Or: ALT + A + C
  2. Name your field
  3. Write your formula
  4. Click OK

The formulas use Tableau’s calculation language, which includes functions for:

  • Aggregation: SUM, AVG, COUNT, MIN, MAX
  • String functions: UPPER, LOWER, LEN, CONTAINS
  • Date functions: YEAR, MONTH, DAY, DATEDIFF
  • Logical functions: IF, CASE, WHEN
  • Spatial functions: MAKEPOINT, MAKELINE, BUFFER, DISTANCE

Tips and Tricks

  • Test your formulas in small steps
  • Use the syntax hints as you type
  • Remember that field names go in square brackets
  • String values go in single quotes

Happy calculating!