Tips for Working with Calculated Fields in Tableau

To help you become more efficient with creating and editing calculated fields in Tableau, this article lists several tips for working in the calculation editor.

Note: The GIFs in this topic show an older version of the UI. The Data pane no longer calls out Dimensions and Measures.

Drag and drop fields into the calculation editor

When creating fields in the calculation editor, you can drag existing fields from the Data pane into the editor at any time.

Drag and drop formulas from the calculation editor to the Data pane

When typing a calculation in the calculation editor, you can highlight all or part of the formula and drag it to the Data pane to create a new calculated field. You can then rename the field by typing a name. For more information, see Ad-Hoc Calculations(Link opens in a new window).

Use the functions reference in the calculation editor

When typing a calculation in the calculation editor, you can use the functions reference to browse all the functions available in Tableau.

To open the functions reference:

In the calculation editor, click the triangle icon on the right-side of the editor.

To add a function from the reference to a formula:

In the function reference, double-click a function.

Take advantage of auto-complete for formulas

As you type a formula in the calculation editor, Tableau suggests options to complete items in your formula. Tableau suggests functions, fields in your data source, parameters, sets and bins that begin with or contain the string you type. The list of suggestions update as you type.

To add an item from auto-complete to a formula:

Press Enter on your keyboard to select the highlighted suggestion. You can use the up and down arrows on your keyboard to move between items in the auto-complete list.

Drag table calculations into the calculation editor to edit them

When you create a table calculation, you can drag it into the calculation editor to review or make changes to the formula.

To edit a table calculation in the calculation editor:

  1. In the Analysis menu, select Create Calculated Field...
  2. From the worksheet, drag the table calculation into the calculation editor.
  3. When finished, click OK.

Resize text in the calculation editor

You can adjust the size of the text in the calculation editor as you create or edit calculations.

To increase text size in the calculation editor:

Press the CTRL and + keys on your keyboard (Command + on a Mac)

To decrease text size in the calculation editor:

Press the CTRL and - keys on your keyboard (Command - on a Mac).

Note: Text size persists until you close the editor. The next time you open the editor, text is at the default size.

See which sheets are using a calculated field

As you edit a calculated field, you can click Sheets Affected to see which other sheets are using the field. These sheets will also be updated when you commit your changes.

Format numbers and dates

Tip: Sometimes a calculation isn't needed, just some formatting.

There are times that a number or date value will be correct but it doesn't appear how you'd like. For example, a date displaying as 2027/02/02 instead of 2Feb27. This doesn't need a date calculation to fix. Instead, format the date to the visual presentation you desire.

Similarly, the results of the ROUND() function can sometimes display oddly due to details of the data source. To control how the results appear, set the number format to specify the number of decimal points.

 

Thanks for your feedback!Your feedback has been successfully submitted. Thank you!