Tableau calculations help you create new data based on the existing one. A very good example of calculated field is Profit ratio – which is as a result of dividing SUM(Profit) and SUM(Sales).
You can use calculated fields in different ways, such as;
Segmenting data
Converting data type of a field – such as string to date field
Aggregating data
Filtering results
Calculating ratios etc.
You can build your first calculated field in Tableau as follows;
Step 1: Open the calculation editor.
You can open the calculation editor in the following three ways;
1. By going to the Analysis menu >> Create Calculated Field…
2. Right click anywhere on the dimension or measure area >> Create >> Calculated Field…
3. On the data pane – open the drop down menu on top of the dimension area >> Create Calculated Field…
Step 2: Name your calculation and enter your formula in the calculation editor
In this case, have named the calculation – Profit ratio
And used this formula - SUM(Profit)/SUM(Sales)
Click okay.
Note: The new calculated field is added to the data pane either under dimensions or measures. If your calculation computes quantitative data then it’s added to the measures. If it computes qualitative data then it’s added to the dimensions.
In this case, Profit ratio is added to the measure area.
Note: The complexity of your calculation will vary depending with the type of calculation (basic, level of detail (LOD) expressions or Table calculations) and kind of challenge you’re working on.
To receive more of the Tableau tips and tricks – kindly subscribe to our mailing list below.
Thank you for reading.