How to create Calculated Fields in Tableau?

Calculated fields allow you to create new data from data that already exists in your data source. When you create a calculated field, you are essentially creating a new field (or column) in your data source, the values or members of which are determined by a calculation that you control. This new calculated field is saved to your data source in Tableau, and can be used to create more robust visualizations. You can use calculated fields for many, many reasons. Some examples might include:

  • To segment data
  • To convert the data type of a field, such as converting a string to a date.
  • To aggregate data
  • To filter results
  • To calculate ratios

You create calculated fields using 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 - Just like basic calculations, LOD calculations allow you to compute values at the data source level and the visualization level. However, LOD calculations give you even more control on the level of granularity you want to compute.
  • Table calculations - Table calculations allow you to transform values at the level of detail of the visualization only.