May 26, 2021 Tableau
Numerical calculations in Tableau are done using a large number of built-in functions provided in the formula editor.
In this chapter, we'll see how to apply calculations to fields. /b10> The calculation can simply subtract the value of two fields or apply the aggregate function to a single field.
Here are the steps to create a calculated field and use a numeric function in it.
When connecting to the Ample-superstore, go to the Anallysis menu and click the Creative a Calculated field, as shown in the following image.
The steps above open the calculation editor, which lists all the features available in Tableau. /b10> You can change the down-list values to see only digital-related features.
Our goal is to study the differences between profits and discounts for products of different modes of transport. /b10> So we create a formula that subtracts the discount from the profit, as shown below. /b11> In addition, we named this field profit_n_discount.
The above calculated fields can be used in the view by simply dragging them to the Rows area, as shown below. /b10> It generates a bar chart that shows the difference between profits and discounts for different modes of transportation.
In a similar way, we can use the aggregation function to create calculated fields. /b10> Here we create AVG (Sales) values for different ship modes. /b11> We write the following formula in the calculation editor.
Click OK and drag Avg_Sales field to the Rows shelf, and we get the following view.