Pivots
Pivots help you analyze specific parts of your dataset using features like dimensions, measures, filters, and report styles. To create a pivot, you need to use fields that are already part of the underlying dataset.
For more information about pivots in SuiteAnalytics Workbook, see Workbook Pivot Tables.
You can create a pivot using workbook.createPivot(options). This method creates a workbook.Pivot object. To create a pivot, you'll need to provide these required parameters:
-
columnAxis
– The column axis for the pivot. Use workbook.createPivotAxis(options) to create axes. For more information, see Pivot Axes. -
dataset
ordatasetLink
– The underlying dataset or linked dataset for the pivot. You can provide either a dataset (using thedataset
parameter) or a linked dataset (using thedatasetLink
parameter), but you can't use both simultaneously. For more information, see Datasets and Dataset Linking. -
id
– A script ID for the pivot. You can provide this ID to Workbook.runPivot(options) to obtain the results of the pivot. -
name
– A name for the pivot.
var myPivot = workbook.createPivot({
columnAxis: myColumnAxis,
dataset: myDataset,
id: 'MyPivot',
name: 'My Pivot',
rowAxis: myRowAxis
});
You can also provide these optional parameters for workbook.createPivot(options):
-
aggregationFilters
– A set of conditional filters or limiting filters that are applied to the pivot. Use workbook.createConditionalFilter(options) to create conditional filters, and use workbook.createLimitingFilter(options) to create limiting filters. For more information about filters in SuiteAnalytics Workbook, see Workbook Visualization Filters. -
filterExpressions
– A set of simple, non-aggregated value-based filters for the pivot. You provide these filters as a set of workbook.Expression objects. Use workbook.createExpression(options) to create these expressions. For more information, see Expressions. -
portletName
– A name for the pivot when it is displayed as a portlet in NetSuite. -
reportStyles
– A set of report styles for the pivot. Use workbook.createReportStyle(options) to create report styles. For more information, see Styles.
var myPivot = workbook.createPivot({
aggregationFilters: myAggregationFilters,
columnAxis: myColumnAxis,
dataset: myDataset,
filterExpressions: myFilterExpressions,
id: 'MyPivot',
name: 'My Pivot',
portletName: 'My Pivot as a Portlet',
reportStyles: [myFirstReportStyle, mySecondReportStyle],
rowAxis: myRowAxis
});