Tableau is the fastest growing business intelligence tool in the world which is mainly used for processing, analyzing, and deriving insights from the data which is available from the various data source. If you truly want to take your analysis to the next level can be only achieved by using calculations in tableau. Like any analytical software whether R, Excel, SAS, or Tableau, calculations on the tableau calculated field are the key to going from beginner to advanced. Tableau Calculated fields are one of the most powerful features of Tableau because It allows the authors to create new data out of the existing data. Calculated fields in Table help create new dimensions for example segments and new measures like ratios or sums. In this blog, we will be looking at the following topics.

Why use calculated fields?

Build your first calculated field in tableau.

Types of calculations

Logical Calculations in Tableau calculated field

Date Functions in Tableau calculated field

**Why use calculated fields?**

To obtain accurate business intelligence, it is vital to focus on the data preparation process to improve the quality of data. The resulting high-quality data will simplify the data analytics process irrespective of data size or source. Therefore, it’s always important to prepare your data as much as possible before it gets into Tableau. Below are the main reasons for using calculated fields in Tableau.

To get rid of unwanted results for better analyses.

To segment data in new ways

To prove a concept such as a new dimension or measure before making it a permanent field in the underlying data.

To convert the data type of a field, such as converting string to date

To aggregate data

To take advantage of the power of parameters, putting choice in the hands of your end-users

To calculate ratios across different variables in Tableau, saving database processing and storage resources

**Build your first calculated field in Tableau**

STEP 1 - There are three ways to open a calculated field.

Analysis Menu >> Create calculated Field…

Right-click anywhere on the dimension or measures areas>>Create>>Calculated Filed…

On the data pane – open the drop-down menu on top of the dimension area >> Create Calculated Field…

STEP 2- In the calculation editor, implement the following steps:

Enter a name for the calculation field. In this example, the field is called TotalSales.

Enter a formula that represents your logic. For this example, the following formula is used.

This formula gives us the total sales for Items.

When finished, click OK.

The new Calculation field is added to Measures in the Data pane as shown in the below picture prefixing equal to sign.

*Note:** The new calculated field is added to the data pane either under dimensions or measures. If your calculation computes quantitative data then it’s added to the measures. If it computes qualitative data then it’s added to the dimensions. In this case, the Profit ratio is added to the measures area.*

*Note** – When you’re in Tableau creating a calculated field, Tableau prohibits mixing Aggregate and Non-Aggregate Arguments.*

**Types of calculations**

There are three main types of calculations you can use to create calculated fields in Tableau:

**Basic Calculations**- Basic calculations allow you to transform values or members at the data source level of detail (a row-level calculation) or at the visualization level of detail (an aggregate calculation).**Level of Detail (LOD) expressions**– LOD calculations allow you to compute at the visualization level and data source level. These calculations give you even more control over the level of granularity you want to compute. They can be performed at a more granular level (INCLUDE), a less granular level (EXCLUDE), or an entirely independent level (FIXED) with respect to the granularity of the visualization.**Table calculations**- Table calculations allow you to transform values at the level of detail of the visualization only.

**Logical Calculations in Tableau Calculated Field**

Logical calculations allow you to determine if a certain condition is true or false (Boolean logic).

**Date Functions in Tableau calculated field**

Date functions allow you to manipulate dates in your data source.

*Note - The complexity of your calculation will vary depending on the type of calculation (basic, level of detail (LOD) expressions or Table calculations) and the kind of challenge you’re working on.*

**Conclusion**

We saw what are the different ways to open calculated fields in tableau. And how to create a calculated field in tableau. Using a Calculated field is when you truly start to take your analysis to the next level, so it's critical to learn the main logical functions that are extremely useful to get the ball rolling. We also learned about the date function which helps to manipulate dates in your data source. And finally some very important tips in using calculated fields.

## Commentaires