Tableau Numeric Calculations
In Tableau, numeric calculations are done using a wide range of inbuilt functions available in the formula editor.
Let’s see how to apply calculations to the fields. The calculations are simple as subtracting the values of two fields or using an aggregate function to a single field.
Here are the steps to create a calculation field and use numeric functions in it.
How to Create a Calculated Field
- After connecting to a data source such as Sample-Superstore .
- Go to Analysis menu.
- And click on Create Calculated Field as shown in the below image.
Calculation Editor in Tableau
The above process opens a calculation editor which lists all the functions available in Tableau.
You can change the dropdown value and only see the related functions to numbers.
Create a Formula
o visualize the difference between Profit and Discount for different shipping mode of the products, create a formula that subtracts the Discount from the Profit , as shown in the below image, and the name of this field is profit_n_discount .
Using the Calculated Field
The above-calculated field can be used in the view by dragging it to the Rows shelf as shown in the below screenshot.
It produces a bar chart that shows the difference between profit and discount for different shipping modes.
Applying the Aggregate Calculations
You also can create a calculated field using an aggregate function.
- First, create AVG (sales) values for different ship mode.
- Then, Write the formula in the calculation editor as shown in the below screenshot.
- Click OK and dragging the Avg_Sales field to the Rows shelf, then you get the following view.