Basic Calculated Fields (String, Number & Date Math)0%

Basic Calculated Fields (String, Number & Date Math)

Beginner12 min read•Updated: Jul 11, 2026
Study Materials

Basic Calculated Fields in Tableau

Reading Time: 8 Mins | Level: Beginner to Advanced


1. What is a Calculated Field?

A Calculated Field allows you to create new data fields from existing data in your data source using formulas, logic, and math.


2. Common Calculation Types

1. Arithmetic Calculations:

Output
// Profit Ratio
[Profit] / [Sales]
 
// Net Margin After Tax
([Sales] - [Cost]) * 0.82

2. Logical Statements (IF-THEN-ELSE & CASE):

Output
IF [Profit Ratio] > 0.20 THEN "High Margin"
ELSEIF [Profit Ratio] > 0.05 THEN "Moderate"
ELSE "Low / Loss Making"
END

3. String & Date Functions:

Output
// Extract uppercase customer initials
UPPER(LEFT([Customer Name], 1))
 
// Calculate age of account in days
DATEDIFF('day', [Order Date], [Ship Date])

Interactive Quiz

Multiple Choice Questions

Question 1
What keyword must always terminate an IF...THEN...ELSE logical block in Tableau calculations?
Question 2
Which function calculates the number of days between an Order Date and a Ship Date?
Question 3
What does the ZN() function do in Tableau?
Question 4
How are field names referenced inside a Tableau calculation editor?
Question 5
What does the calculation SUM([Profit]) / SUM([Sales]) compute compared to [Profit] / [Sales]?

Next Lesson

Table Calculations: Running Total, Percent of Total, Rank & Moving Average

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

PrevNext