Efficient calculations

Calculations may be constructed differently and yet accomplish the same thing, for instance:

Scenario I

Scenario II

  • Create a calculated field with the following code:
    IF SUM (Profit) > 0 THEN   
    'Profitable' ELSE   
    'Unprofitable' END   
    
  • Place the calculated field on the Color shelf.

  • Create a calculated field with the following code:
    SUM (Profit) > 0   
    
  • Place the calculated field on the Color shelf.
  • Right-click on True and False in the resulting legend and rename as Profitable and Unprofitable.

Since either of the preceding scenarios will return the desired results, which should be used? The deciding factor is performance. This section will explore what to do and what to avoid when creating calculated fields in order to maximize ...

Get Mastering Tableau 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.