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:
-
Open the Visualization
-
Open the workbook and select the dataset in which you want to create a calculated field.
-
On your dataset page, open the Fields tab.
-
To create a new field, click + Add field and enter the Field name. Stay on the Formula tab.
-
Select one or more existing fields from the list on the left.
-
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.
-
(optional) Check the Don't display in wizard box to hide the field by default.
-
Click Create.
-
Click Update fields to see the new field on the list.
-
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) iftrue
, doesn't the field in the dataset's field list. If unspecified, defaults tofalse
. -
aggregation
- applies aggregation to the field. -
calc_spec
- defines the data field specification.
-