How to Add a Calculated Column


TIBCO Spotfire supports two different types of expressions: Add Calculated Column, which creates a new column in the data table, and Custom Expression, which is used to dynamically modify the expression used on an axis or to define a setting. Both types of expressions are created with a similar user interface.

Tip: You can also add a calculated column to a data table from the Data canvas, by clicking the plus sign on the final data table node, and selecting Add calculated column.

To insert a calculated column in the data table:

  1. On the menu bar, select Data > Add calculated column.

  2. If you have more than one data table in the document, select the Data table to work on.

  3. Specify a suitable expression by either typing it directly into the Expression text field, or by selecting columns, properties and functions from the list.
    An example of an expression could be: [Exports m$]/[Population].

    Comment: You can always modify the expression by editing the text in the Expression field, using cut-and-paste, or by typing text. For a detailed description of the expression language, see General Syntax and other topics under Expression Language. For details on the syntax to use when adding properties, see Properties in Expressions.

  4. Verify that the result seems reasonable by looking at the Sample result field, or click Preview for some more information.

    Comment: If an error message is shown in the sample result field, there is a problem with the expression. Go back and modify the expression until the desired result is achieved. A preview can only be shown for valid expressions.

  5. If desired, you can change the Formatting of the new column.

  6. Type a Column name for the new column.

  7. Click OK.

    Response: The expression is now evaluated for each row in the data table and a new column is created. A filter will appear with the name of the new column you created.

Tip: If you have previously created a suitable expression, you may select it from the Recent expressions list and click the Insert button.

To reach the Custom Expression dialog:

  1. Right-click on a column selector on an axis, in a Visualization Properties dialog, or in the Legend, to display the menu.

  2. Select Custom Expression....

    Comment: See How to Insert a Custom Expression for more information.

See also:

What is a Calculated Column?

Details on Add Calculated Column

Details on Custom Expression