Calculated Field in Tableau

If your data source doesn’t include the fields that you are looking for, then you can create a tableau Calculated Field. In this article, we will show you how to create calculated Field in Tableau with an example.

How to Create a Calculated Field in Tableau

You can create a Tableau calculated field in multiple ways. The first approach is: Please navigate to Analysis Tab and select the Create Calculated Field… option.

For this Tableau Calculated Field demonstration, we are going to use the data source that we created in our previous article. So, please visit Data Labels in Reports article to understand the Tableau Data Source.

Calculated Field in Tableau 1

Once you click on the Create option, a new window will be opened to write the calculation.

Write an Expression using Functions 2

Second Approach to Create Calculated Field in Tableau

Please click on the Down arrow beside the Sales Amount Measure (change as per your requirement). Or right-click on it to open the context menu. From the list of available options, please select the Create option and then select the Calculated Field… option as shown below.

Calculated Field in Tableau 3

Once you click on the option, a new window will be opened to write the calculation. Use this calculation editor to write functions.

Expression using existing fields and functions 4

If you know the formula, you can write directly on that Measure or any other Measure. Otherwise, click on the side arrow to list out all the functions available in Tableau. If you know the function name, use the search box to search for the item. And, if you don’t know then click the down arrow and select the function type

Calculated Field in Tableau 5

In this field example, we will calculate the Running Total so, we are using the RUNNING_SUM function. Here, you can see the example to understand the syntax of a function.

Calculated Field in Tableau 7

Double click on it will automatically add the function to the calculated region. From the below screenshot you can observe that we changed the Calculated filed name to Sales Running Sum

Change the Name of a Calculated Field in Tableau 8

Now you can see our newly created calculated field under Tableau measures

Calculated Field in Tableau 9

We created one table report to show our newly created calculated field result. As you can see, the last column is displaying the Running Total.

Calculated Field in Tableau 10

Edit Calculated Field in Tableau

To change the existing table calculation, click on the down arrow beside the table calculation, and select the Edit.. option.

Calculated Field in Tableau 11

Once you on click the Edit.. option, the following window will be opened to edit the existing calculation or function

Calculate Running Sum 12

Let us change the function name from RUNNING_SUM to RUNNING_AVG. Or write your custom function on calculation editor and click OK

Calculate Running Average 13

Now you can see that the last column in our report is displaying the Running Average calculation in tableau report.

Calculated Field in Tableau 14

Comments are closed.