What is a Calculated Field?
Calculated fields are a place for the Tableau user to build calculations based on existing data. Calculations can modify data types and formats, aggregate numerical data, and create new fields, which lead to creating more impactful visualizations.
To Create a Calculated Field
- Go to the Data Pane on the left hand side.
2. Click the ▼ to the right of the search bar.
3. Click "Create Calculated Field..."
4. Replace "Calculation1" with the name of the calculation.
5. Build the calculation in the space below
Colors of Calculated Fields
Different parts of the calculation are different colors, and each color signifies a different purpose:
Orange: Fields, otherwise known as columns. In the Superstore data set, this would include most fields in the Orders, People and Returns tables.
Purple: Parameters. Per help.tableau.com, "A parameter is a workbook variable such as a number, date, or string that can replace a constant value in a calculation, filter, or reference line." These function at the workbook level and are independent of the data source.
Blue: Aggregators. These allow the user to summarize rows in the data set. For example, if there is a question about how many customers are in the Superstore data set, then the COUNTD aggregator would be used to count all order IDs. Other aggregators include COUNT, SUM, MIN, MAX and AVG.
Black: Operators. These are mathematical symbols that are used when building calculations, which include: + - = < >.
Gray: Comments. The comment function activated after typing // and are useful for new users who are learning to understand a calculation's purpose, and to document other relative information.
Red: Calculation Errors. After clicking on the red error message, a description of the error will appear.
Calculated fields are needed to perform advanced data manipulations, customized analyses, and create more impactful visualizations.