Summaries configuration is available only for the pivot grid data sources whose store differs from the XmlaStore. If the pivot grid is configured for displaying data of a remote OLAP cube, an OLAP server provides data fields configuration.

Summaries are values (often numeric) displayed in the pivot grid cells. Each summary value is located at the intersection of a row header group and column header group. Headers describe the meaning of each summary value. Summaries are configured in the fields of the "data" area (data fields or measures in OLAP terminology). If the "data" area contains more than one field, the column header is supplemented with another row that helps to identify the data field to which the summary value belongs. The following image explains how to interpret summary values.

Predefined Summaries

To configure a data field for using one of the predefined aggregation methods, set the summaryType option to one of the following values.

  • "sum"
    Sums up all facts within an area.
  • "min"
    Calculates the minimum fact's value.
  • "max"
    Calculates the maximum fact's value.
  • "avg"
    Calculates the average of all facts within an area.
  • "count"
    Calculates the number of facts within an area.

You can configure the type of a value held in a field using the dataType option. This is useful when the field data has an unusual format, for example, a date saved as a string. When the dataType is not set, it is defined automatically.

Custom Summaries

If the list of built-in summary types does not contain an option satisfying your requirements, you can implement your own aggregate function. Assign it to the calculateCustomSummary option and set the summaryType option to "custom". In this case, the function assigned to the calculateCustomSummary field will be called for each fact and the overall result will be used as a summary value. The example below shows how to implement the variance aggregation function.

var sum2, n;
var pivotGridSettings = {
    dataSource: {
        fields: [{
            area: 'data',
            caption: 'Var',
            summaryType: 'custom',
            calculateCustomSummary: function (options) {
                if (options.summaryProcess == 'start') {
                    options.totalValue = 0; //Sum
                    sum2 = 0; //Sum of squared values
                    n = 0;
                if (options.summaryProcess == 'calculate') {
                    options.totalValue += options.value;
                    sum2 += Math.pow(options.value, 2);
                if (options.summaryProcess == 'finalize') {
                    options.totalValue = sum2 - Math.pow(options.totalValue, 2) / n;
                    options.totalValue /= n - 1;