API reference
Table of contents

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/Type Description
uniqueName
String
The measure’s unique name.
active
Boolean
optional Indicates whether the measure will be selected for the report (true) or not (false). active: false can be useful if the measure has non-default properties, but should not be selected for the grid or the chart.
aggregation
String
optional The name of the aggregation that will be applied to the measure. To see the list of supported aggregation functions for each data source type, refer to Flexmonster’s technical specifications.
If the measure is calculated, skip the aggregation property.
caption
String
optional The measure’s caption.
formula
String
optional Represents the formula. Refers to the calculated measure. It 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 a list of supported aggregations in Flexmonster’s technical specifications.
  • Calculated measures. To address another calculated measure, specify its unique name. For example, "Formula #1".
individual
Boolean
optional Refers to the calculated measure. Defines whether the formula is calculated using raw values (true) or using aggregated values (false).
Only for "json" and "csv" data source types.
Default value: false.
calculateNaN
Boolean
optional Refers to the calculated measure. Defines whether the formula is calculated using NaN values (true) or using null values (false).
Default value: true.
format
String
optional The name of the number formatting that will be applied to the measure.
Measure values can be formatted according to the number formatting defined in the report. All available formats are stored in the formats array in the report.
More information about the number formatting part of the report can be found in the number formatting article.
grandTotalCaption
String
optional The measure’s grand total caption.

Examples

Example with the MeasureObject:

slice: {
  // Other slice properties
  measures: [
    {
      uniqueName: "Price",
      aggregation: "sum",
      format: "currency",
    },
    {
      uniqueName: "OverallPrice",
      formula: "sum('Price') * sum('Amount')",
      individual: true,
      caption: "Overall price",
    }
  ],
}