Pivot Table & Charts Component Documentation



Version: 1.5

This API call adds calculated measure. Calculated measure has formula property. Also each measure has a property calculated. If it is true, 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 CSV data source.


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 – measure caption.
  • calculated — boolean value that defines whether measure is calculated.
  • formula – string that represents the formula that can contain the following operations: +, -, *, /; 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 data source: "sum", "count", "distinctcount", "average", "product", "min", "max", "percent", "percentofcolumn", "percentofrow", "index".
  • grandTotalCaption (optional) – measure grand total caption.
  • availableAggregations (optional) — array of strings that represents the list of aggregation functions which can be applied to the current measure. If it is calculated measure, it will be [].
  • aggregation (optional) — type of aggregation function that will be applied to the measure ("sum", "count", "distinctcount", "average", "product", "min", "max", "percent", "percentofcolumn", "percentofrow", "index"). If it is calculated measure, it will be "none".
  • 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).
  • format (optional) – number formatting name.


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

var measure = {
  formula: 'sum("[Measures].[Price]")/count("[Measures].[Price]")',
  calculated : true,
  uniqueName: "[Measures].[Average Price]",
  caption: "Average Price",
  grandTotalCaption: "Total Average",
  active: false

See also


Suggest Edit