What a Calculated Field Does and When You Need One

A calculated field in Tableau is a new column of data you create by writing a formula that combines, transforms, or compares information already in your dataset. Instead of going back to your original spreadsheet or database to add a new column, you build it directly inside Tableau and it updates automatically whenever your data refreshes.

You use calculated fields when you need something your raw data does not have: profit margins from revenue and cost figures, age from birth dates, sales totals grouped by region, or a yes/no flag based on whether a number meets a threshold. The formula you write tells Tableau exactly how to compute each row.

The alternative is to add the column in Excel or your database before you connect to Tableau, which works but means you have to maintain two versions of your data. A calculated field lives in Tableau alone, so you change the logic once and every dashboard using it updates immediately.

Key Takeaways

  • Open the Data pane on the left, right-click the dataset name, and select Create Calculated Field to start a new formula.
  • Name your field something descriptive like "Profit Margin" or "Days Since Order", then write a formula using Tableau functions and existing field names in square brackets.
  • Test your formula by clicking OK; Tableau will show you an error message if the syntax is wrong, and you can edit it immediately.
  • Once created, your calculated field appears in the Data pane under the dataset it belongs to and works like any other field in charts and filters.
  • Calculated fields run on Tableau's server or your computer, not in your original database, so they do not change your source data.

Opening the Calculated Field Dialog

Start by opening Tableau and connecting to your data source. You should see the Data pane on the left side of the screen, showing the name of your dataset and all the fields it contains.

Right-click directly on the dataset name (not on an individual field) and select Create Calculated Field from the menu. A dialog box will open with a blank text area where you write your formula. At the top of the dialog, you will see a text field labeled "Name" — this is where you type what you want to call your new field.

Give your field a clear, specific name. "Profit" is better than "Calc1". "Days Since Order" is better than "New Field". This name will appear in your Data pane and in any chart or filter you use it in, so future you and anyone else reading your workbook will understand what it contains.

Writing Your Formula

Below the Name field is a large text box where you type your formula. Tableau formulas use functions (like SUM, IF, DATEDIFF) and field references (the names of columns from your data, written in square brackets).

Here are the most common patterns. To add two fields together, write [Revenue] + [Cost]. To calculate a percentage, write [Profit] / [Revenue] * 100. To check if a value meets a condition, write IF [Sales] > 10000 THEN "High" ELSE "Low" END. To find the number of days between two dates, write DATEDIFF('day', [Order Date], [Ship Date]).

The key rule: always put field names in square brackets, like [Sales] or [Customer Name]. Tableau will not recognize Sales or Customer Name without the brackets. If you are not sure of the exact field name, look at the Data pane — copy the name exactly as it appears there, including capital letters and spaces.

As you type, Tableau shows you a list of available functions and fields below the text box. You can click on a suggestion to insert it, or keep typing to write it yourself. When you are done, click the OK button at the bottom right of the dialog.

What Happens When You Click OK

Tableau checks your formula for errors. If the syntax is wrong — for example, you forgot a closing bracket or used a function name that does not exist — Tableau will show you a red error message telling you what went wrong. Read the message, click back into the text box, and fix the problem. Then click OK again.

If your formula is correct, the dialog closes and your new calculated field appears in the Data pane under the dataset name, usually at the bottom of the field list. It will have a small function symbol (ƒ) next to its name to show it is calculated, not raw data.

Your field is now ready to use. Drag it into a chart just like any other field. Put it on a shelf, add it to a filter, or use it in another calculated field. Tableau computes the value for every row in your data automatically.

Common Mistakes and How to Fix Them

The most frequent error is forgetting square brackets around field names. If you write SUM(Sales) instead of SUM([Sales]), Tableau will not recognize "Sales" and will show an error. Copy the field name from the Data pane and wrap it in brackets.

Another common problem is using the wrong function for your data type. If you try to add text fields together with a plus sign, Tableau will reject it. Dates need date functions like DATEDIFF or DATEADD, not arithmetic. Numbers need SUM, AVG, or math operators. If you are not sure which function to use, type the first letter of what you want to do (like "D" for date functions) and scroll through the suggestions.

A third mistake is writing a formula that works for one row but not all rows. For example, if you write IF [Region] = "West" THEN [Sales] ELSE 0 END, this works fine. But if you write IF [Sales] > [Average Sales] THEN "Above" ELSE "Below" END and "Average Sales" is not a field in your data, Tableau will error. You need to calculate the average inside the formula: IF [Sales] > AVG([Sales]) THEN "Above" ELSE "Below" END.

Editing or Deleting a Calculated Field

To change a calculated field after you create it, right-click its name in the Data pane and select Edit. The formula dialog opens again with your current formula. Make your changes and click OK. Every chart or filter using that field will update automatically.

To remove a calculated field, right-click its name and select Delete. Tableau will warn you if the field is used in any chart or filter on your current sheet. You can still delete it, but those charts will break until you remove the field from them. If you delete by accident, use Ctrl+Z (or Cmd+Z on Mac) to undo.

Frequently Asked Questions

Can I use a calculated field inside another calculated field?

Yes. Once you create a calculated field, it appears in your Data pane and you can reference it in a new formula just like any other field. Write [Profit Margin] * [Sales] if Profit Margin is a calculated field you already built. This is useful for breaking complex logic into smaller, easier-to-read pieces.

What is the difference between a calculated field and a parameter?

A calculated field computes a value for every row in your data based on a formula. A parameter is a single value you set once and can change manually — like a threshold or a date range. You often use a parameter inside a calculated field formula, like IF [Sales] > [Sales Threshold Parameter] THEN "High" ELSE "Low" END.

Do calculated fields slow down my dashboard?

Calculated fields run on Tableau's server or your computer, not in your original database, so they do not affect how fast your data loads. Very complex formulas on very large datasets can take longer to compute, but for most use cases the performance is fine. If you notice slowness, check whether you are using expensive functions like LOOKUP or WINDOW_SUM on millions of rows.

Can I see the calculated field formula after I create it?

Yes. Right-click the field name in the Data pane and select Edit to see and modify the formula. You can also hover over the field name and a tooltip will show you the first part of the formula, though it may be cut off if the formula is long.

What if my calculated field shows an error in my chart?

Right-click the field in the Data pane and select Edit to check the formula. Common causes are a field name that no longer exists (if your data source changed), a function that does not work with your data type, or a division by zero. Fix the formula and click OK. If the error persists, check that your data source is still connected and contains the fields your formula references.