When I was building dashboards in Tableau for sales reporting, I faced an issue where the dataset didn’t always contain the exact fields I needed in the view. For example, sales amounts were there, but no profit margins were displayed. For these out-of-the-box values, we need to create calculated fields.
In Tableau, calculated fields allow us to create new columns or measures by using formulas, logic, and functions on an existing dataset.
In this Tableau tutorial, I will explain how to create calculated fields in Tableau and what their use is in creating chart views.
Create a Calculated Field in Tableau
In Tableau, there are two ways to create a calculated field, which are mentioned below.
- In the Navigation bar, click Analysis tab -> Create Calculated Field.

- Another option to create a calculated field is from the Data pane. In the Data pane, click on the dropdown near the search bar and select Create Calculated Field.

Using this approach, we can open the formula editor, in which we can define the calculated field.
Now, in the examples below, we will see different scenarios to create calculated fields in Tableau using the Superstore Datastore.
Example-1: Create a Calculated Field to Display Profit in Percentage
In this example, we will create a calculated field to show Profit Margin %, which shows the profit made per sale.
- To create a calculated field, right-click in the Data pane dropdown and select Create Calculated Field.

- Enter the calculated field label as Profit Margin, then enter the formula below and click OK.
SUM([Profit]) / SUM([Sales])
- To create the chart view, add the calculated field Profit Margin to the Columns and Sub-Category to the Rows.
As of now, the calculation is in number format. To change it to a percentage, click on the “Profit Margin” axis and select Format.

- In the Data Pane, select Default ->