☝️Small business or a startup? See if you qualify for our special offer.
+
All documentation

MeasureObject

This object describes a measure selected in the slice.

Properties

{
  uniqueName: string,
  active: boolean,
  aggregation: string,
  caption: string,
  formula: string,
  individual: boolean,
  calculateNaN: boolean,
  format: string,
  grandTotalCaption: string
}
Property/TypeDescription
uniqueName
String
The measure’s unique name.
active
Boolean
optional Indicates whether the measure will be selected for the slice (true) or not (false).
aggregation
String
optional The name of the aggregation that will be applied to the measure. See the list of supported aggregation functions.
If the measure is calculated, skip the aggregation property.
caption
String
optional The measure’s caption.
formula
String
optional Represents the formula. Must be specified when adding a calculated value. The formula can contain:
  • Operators and functions. Check out the full list.
  • Numbers. Negative numbers can be used as well (see an example).
  • Measures. A measure can be addressed using its unique name and an aggregation function. For example, sum("Price") or max("Order"). See the list of supported aggregations.
  • Calculated measures. To address another calculated measure, specify its unique name. For example, "Formula #1".
individual
Boolean
optional Defines whether the formula is calculated using raw values (true) or using aggregated values (false).
Can be used only for the calculated values.
Only for "json" and "csv" data source types.
Default value: false.
calculateNaN
Boolean
optional Defines whether the formula is calculated using NaN values (true) or using null values (false).
Can be used only for the calculated values.
Only for "json" and "csv" data source types.
Default value: true.
format
String
optional The name of the number format that will be applied to the measure. 
A number format’s name must be defined in the report.formats array.

Live example

grandTotalCaption
String
optional The measure’s grand total caption.

Examples

Example with the MeasureObject:

slice: {
measures: [
// A regular measure
{
uniqueName: "Price",
aggregation: "sum",
caption: "Price",
format: "price",
grandTotalCaption: "Total price",
},
// A calculated value
{
uniqueName: "average_quantity",
active: true,
caption: "Average Quantity",
formula: "sum('Quantity')/count('Quantity')",
individual: true,
calculateNaN: false,
format: "Average Quantity",
grandTotalCaption: "Average Quantity"
},
],
// Other slice properties
}

Live example

See also