Create a calculated field

In addition to the fields with values based on columns from the data source, you can create fields that use functions and operators of different types:

  1. Open the Visualization page in the console.

  2. Open the workbook and select the dataset in which you want to create a calculated field.

  3. On your dataset page, open the Fields tab.

  4. To create a new field, click + Add field and enter the Field name. Stay on the Formula tab.

  5. Select one or more existing fields from the list on the left.

  6. Use the editor to combine these fields the way you need.

    Tip

    Click the Reference button to see the information on all the available functions you can use in your formulas.

  7. (optional) Check the Don't display in wizard box to hide the field by default.

  8. Click Create.

  9. Click Update fields to see the new field on the list.

  10. Click Save in the upper-right corner of your dataset page.

Note

This configuration is a segment in the overall description of Visualization assets in the workbook. For the complete tutorial, see Use Visualization API.

To create a calculated field in the dataset, write the following configuration:

  • ad_hoc_fields:

    • title: the field's title.

    • id - the ID of the calculated field. Must be unique within the dataset.

    • cast - the field's Visualization-specific data type

    • description - (optional) the field's description in plain text format.

    • hidden - (optional) if true, doesn't the field in the dataset's field list. If unspecified, defaults to false.

    • aggregation - applies aggregation to the field.

    • calc_spec - defines the data field specification.

See also