About calculating totals and summary metrics in documents

A metric is calculated differently depending on its location in the document. For example, a metric placed in a text field on a group header or footer section calculates a subtotal for that grouping level. The same metric in a text field on the Document Header or Footer provides a grand total for the document. The following table describes how metrics are calculated in various locations within a document. The information below the table discusses how metrics are calculated depending on which section of the document they are placed in.

Metric Location

Metric Calculation

In a text field in Detail section

At the level returned by the dataset report

In a text field in a group header/footer

Totaled at the level of the group

In a text field in the Document Header/Footer or Page Header/Footer

Totaled across entire dataset

In a Grid/Graph control in a group header/footer

At the level defined by the attributes, consolidations, or custom groups on the Grid/Graph, and at the level of the grouping section

In a Grid/Graph control in the Document Header/Footer or Page Header/Footer

At the level defined by the attributes, consolidations, or custom groups on the Grid/Graph

Note: If a Grid/Graph does not contain anything other than the metric, the metric returns the same value as if it were placed in a text field in that section. This rule applies regardless of what section the Grid/Graph is located in. For more information on Grids/Graphs, see Using Grid/Graphs in documents.

The metric calculation for totals is determined by the default subtotal specified in the metric definition. To specify the function used to calculate a subtotal, create a summary metric. For steps, see Working with summary metrics in documents.

The MicroStrategy Report Services Document Creation Guide contains detailed examples of metric calculation in documents.

Related topics