Get Free Trial
API reference
Table of contents

getAllMeasures

getAllMeasures(): Array

[starting from version: 1.4]

Returns a list of all available measures. Note that getAllMeasures has an async equivalent – getAllMeasuresAsync.

Returns

Array of objects. Each object in the array contains the following parameters:

  • name – String. The measure’s name.
  • uniqueName – String. The measure’s unique name.
  • aggregation – String. The name of the aggregation applied to the measure. If the measure is calculated, aggregation is set to "none".
  • availableAggregations – Array of strings. Represents the list of aggregation functions that can be applied to the current measure. If the measure is calculated, availableAggregations is set to [].
  • availableAggregationsCaptions – Array of strings. Represents the list of available aggregations’ captions. If the measure is calculated, availableAggregationsCaptions is set to [].
  • caption – String. The measure’s caption.
  • format – String. The name of the number formatting that will be applied to the measure.
  • formula optional – String. It represents the formula. For calculated measures.
  • grandTotalCaption– String. The measure’s grand total caption.
  • groupName optional – String. The measure’s group defined in SSAS. Only for the "microsoft analysis services" data source type.
  • type – String. The measure’s type. It is returned for "json", "csv", and "elasticsearch" data source types:
    • For "json" and "csv", the type can be the following: "string", "number", "date", "date string", "year/month/day", "year/quarter/month/day", "datetime", "time".
    • For "elasticsearch", the type’s possible values are described here: Field data types.

If data load is in progress an empty array will be returned.

Example

flexmonster.getAllMeasures(); 

/* method returns array of objects, where the 2nd measure is calculated
[  
{
aggregation: "sum",   
availableAggregations: ["sum", "count", "distinctcount", "average", "product", "min", "max", "percent", "percentofcolumn"],
   availableAggregationsCaptions: ["Sum", "Count", "Distinct Count", "Average", "Product", "Min", "Max", "Percent", "Percent of Column"],
   caption: "Sum of Sales",
   format: "currency",
   grandTotalCaption: "Total Sum of Sales",
   name: "Sales",
   type: "number",
   uniqueName: "Sales"
},  
{
aggregation: "none",
   availableAggregations: [ ],
   availableAggregationsCaptions: [ ],
   caption: "Test",
   format: "",
   formula: "(SUM("Price") / count("Price")) * 100",
   grandTotalCaption: "Total Test",
   name: "Test",
   type: "number",
   uniqueName: "Test"
}
]
*/

Try on JSFiddle.

See also

getAllMeasuresAsync
getMeasures
getAllHierarchies
getColumns
getRows
getReportFilters