CALCULATED FIELDS
When visualizing your data, you are not restricted to the dimensions and measures in your data source; you can also add your own calculated fields. These calculations are saved as new fields in the data model of your workbook and can be used as dimensions or measures in your visualizations.
Let's try this by adding a calculation of the profit margin to the Superstore workbook. Start by clicking the small arrow at the top of the Data pane (to the right of the Dimensions heading). In the context menu, choose the first entry, Create Calculated Field, as shown in Figure 4.2.

Figure 4.2 Adding a calculated field to the Data pane.
Tableau will open an empty window in the calculation editor. First, change the name of the calculated field from Calculation1
to Profit Ratio
or something similar. In the empty field, add the formula for the calculation. For the profit margin, that would be
SUM([Profit])/SUM([Sales])
This simple example only uses the SUM
function, but to...