workbook.CalculatedMeasure

Object Description

A calculated measure object which are used to calculate a value based on the value of fields or other measures.

Use workbook.createCalculatedMeasure(options) to create this object.

A calculated measure object is used as a parameter in the workbook.createMeasureSelector(options) method.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/workbook Module

Methods and Properties

CalculatedMeasure Object Members

Since

2021.2

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/workbook Module Script Samples and Full scripts in the Tutorial: Creating a Workbook Using the Workbook API topic.

            // Add additional code
...
var myCalculatedMeasure = workbook.createCalculatedMeasure({
    label: 'Balance',
    expression: workbook.createExpression({
        functionId: workbook.ExpressionType.MINUS,
        parameters: {
            operand1: workbook.createExpression({
                functionId: workbook.ExpressionType.MEASURE_VALUE,
                parameters: {
                    measure: myFirstDataMeasure
                }
            }),
            operand2: workbook.createExpression({
                functionId: workbook.ExpressionType.MEASURE_VALUE,
                parameters: {
                    measure: mySecondDataMeasure
                }
            })
        }
    })
});
...
// Add additional code 

          

Related Topics

General Notices