Chapter 18. Calculations

Your data will hardly ever be perfect for your analysis straight from the source. Calculations are one of the key instruments you have to make the data suitable for answering the questions you and your peers have. Many people fear calculations, but this chapter offers some simple tips that will make them less intimidating and help you unlock their power and flexibility.

What Do Calculations Do in Data Preparation?

At the simplest level, calculations create a new data field or overwrite an existing one. Most calculations use an existing data field as the base to form the new data field. The new or altered field is referred to as a Calculated Field, indicating that it did not originate in the initial input data for your preparation flow. New data fields are created as a result of:

  • Cleaning (to remove unwanted characters, split names, etc.)

  • Arithmetic (sum, average, or multiplication results)

  • Merging multiple fields (from dates, email addresses, etc.)

The calculated data fields resulting from these operations become available for analysis or further preparation. Calculations create new fields in Prep unless the calculation is named identically to an existing data field, in which case the original data field is overwritten.

Creating a Calculated Field

There are two main ways to create Calculated Fields in Tableau Prep. First, underneath the Flow pane where either the Profile or Data pane is shown, you’ll see the option Create Calculated Field ( ...

Get Tableau Prep: Up & Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.