Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Tableau numerical calculations


May 26, 2021 Tableau


Table of contents


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.

Create a calculated field

When connecting to the Ample-superstore, go to the Anallysis menu and click the Creative a Calculated field, as shown in the following image.

Tableau numerical calculations

The calculation editor

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.

Tableau numerical calculations

Create a formula

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.

Tableau numerical calculations

Use calculated fields

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.

Tableau numerical calculations

Apply aggregation calculations

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.

Tableau numerical calculations

Click OK and drag Avg_Sales field to the Rows shelf, and we get the following view.

Tableau numerical calculations