This website is for Vega-Lite v4. Go to the main Vega-Lite homepage for the latest release.

Calculate Transform

Edit this page

The formula transform extends data objects with new fields (columns) according to an expression.

// Any View Specification
{
  ...
  "transform": [
    {"calculate": ..., "as" ...} // Calculate Transform
     ...
  ],
  ...
}
Property Type Description
calculate String

Required. A expression string. Use the variable datum to refer to the current data object.

as String

Required. The field for storing the computed formula value.

Example

This example uses calculate to derive a new field, and then filters the data based on the new field.