Table of contents



[starting from version: 2.3]

This API call adds calculated measure. Calculated measure has formula property. If it is defined, the measure is calculated. You can create as many calculated measures for one report as you need, there is no limit towards the number of calculated measures. When you save the report all the calculated measures will be saved as well and loaded when report is retrieved. Please note that you can add calculated measures only for reports based on JSON, CSV and OCSV data sources.


measure – the object that describes measure. This object has the following parameters:

  • uniqueName – measure unique name, this property will be used as an identifier for the measure inside Pivot component and as the identifier to remove calculated measure via API.
  • caption (optional) – measure caption.
  • formula – string that represents the formula that can contain the following operations: +, -, *, /; the following operators:isNaN(), !isNaN(); other measures can be addressed using measure unique name and aggregation function, for example sum("Price") or max("Order"). Pivot supports the following aggregation functions for CSV, OCSV and JSON data sources: "sum", "count", "distinctcount", "average", "product", "min", "max", "percent", "percentofcolumn", "percentofrow", "index", "difference", "%difference", "runningtotals", "stdevp", "stdevs".
  • grandTotalCaption (optional) – measure grand total caption.
  • active (optional) – boolean value that defines whether the calculated measure will be added to the list of available values but not selected (false) or will be selected for the report (true).
  • individual (optional) – Boolean. Defines whether the formula is calculated using raw values (true) or using aggregated values (false). Default value is false.
  • format (optional) – number formatting name.


The following example shows the calculated measure Average Quantity which is calculated as sum("Quantity")/count("Quantity") and will be added to the list of available measures but not selected for the report (active: false):

var measure = {
  formula: 'sum("Quantity")/count("Quantity")',
  uniqueName: "Average Quantity",
  caption: "Average Quantity",
  grandTotalCaption: "Total Quantity",
  active: false

Open the example on JSFiddle.

See also

Calculated values tutorial