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.
When creating fields in the calculation editor, you can drag existing fields from the Data pane into the editor at any time.
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).
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.
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.
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:
- In the Analysis menu, select Create Calculated Field...
- From the worksheet, drag the table calculation into the calculation editor.
- When finished, click OK.
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:
+ keys on your keyboard (
Command + on a Mac)
To decrease text size in the calculation editor:
- 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.
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.