Creating measures
Measures are calculations used in visualizations, typically represented on the y-axis of a bar chart or a column in a table. Measures are created from an expression composed of aggregation functions, such as Sum or Max, combined with one or several fields.
An expression is a combination of functions, fields, and mathematical operators (+ * / =). Expressions are used to process data in the app in order to produce a result that can be seen in a visualization.
Overview
There are three different ways of specifying measures in the columns definition:
- As a string
- As a NxMeasure structure
- As a reference to a predefined measure, a so-called master measure
Defining measures using string syntax
Using the string syntax is the easiest way of defining measures. But there are some limitations and if you want create more advanced measures, you should use the object syntax instead
Defining measures using the object syntax
Use the object syntax if you want to set more options for your measures, for example if you want to set labels or define number formatting.
The NxMeasure structure
When defining measures using the object syntax you define it as a NxMeasure structure. Most settings are however done inside "qDef" which is a NxInlineMeasureDef structure.
For full details, see Engine API: NxMeasure
Referencing predefined measures
You can use measures that are predefined in the app. You must know the Measure ID, which is defined in the qLibraryID property. You must also state that it is a measure in the qType property.