Introduction to Tableau Numeric Calculations
In Tableau, the Numeric calculations are done by using an extensive range of inbuilt functions available in the formula editor. Numeric calculations allow you to perform various computations on the data values present in your fields.
Create Calculated Field
- In the Tableau Desktop, connect to the Excel file named FacebookData which is saved in the data source.
- Navigate to the worksheet pane and click on Analysis > Create Calculated Field as shown below:
- You will notice that a new dialogue box has appeared. Click on the icon present on the rightmost side of the box.
- You can see a tab linked with the previous one which lists all the functions that are available in Tableau.
- Further, you can change the dropdown value and choose only the functions that are related to numbers.
- On the rightmost side of the pane, you will notice that Tableau is briefing us with the formula and small explanation for the selected functions.
Create a Formula
To study the maximum number of sales for the different region in the Facebook data, we will create a formula of finding the max sales from the whole range of data as shown in the following screenshot. Also, name this field as Max_Sales. And click on Ok.
You will find that a new field named Max_Sales has been created in the measure column.
Applying the Calculated Field
The above-calculated field can be applied in the view by dragging it to the Rows shelf as displayed in the following screenshot. It produces a bar chart showing the maximum number of sales held for the different regions.
Applying Aggregate Calculations
We can create different calculations in the same manner as above. Next, we will create a calculated field using an aggregate function. Follow the same steps:
Open the calculated field and create AVG(sales) values for Regions. Write the numeric formula for the AVG(sales)in the calculation editor as shown in the following screenshot.
Change the name to Avg_Sales. Click on the ok option. You will notice that a field named with Avg_Sales has been created under the measures. Drag that field to the rows shelf and dimension Region to the column shelf. The following screenshot appears showing the bar charts for average sales occurred in different regions.