Calculated Fields

In Tableau, calculated fields are expressions or formulas created by the user to perform calculations on existing fields or data in the dataset. These calculated fields can be used to create new dimensions, measures, or to modify existing data.

Lets create a calculated field using the following formula:

Profit_Margin = SUM([Profit]) / SUM([Sales])
  1. Open your Tableau workbook and go to the sheet where you want to add the profit margin calculation.
  2. Click on the drop-down arrow next to the Measures pane and select “Create Calculated Field.”
  3. In the “Create Calculated Field” dialog box, give your calculated field a name such as “Profit Margin.”
  4. Type the formula SUM([Profit]) / SUM([Sales]) into the formula box.
  5. Click “OK” to close the dialog box.
  6. Drag and drop the new “Profit Margin” field onto the view to see the profit margin percentage for each row of data.