About creating metrics in documents

Metrics that an analyst can define in a document include calculated expressions, derived metrics, and summary metrics. They are created in the document, not in the dataset report. However, like other metrics, they are calculated at the level of the dataset. They all provide different benefits and are used in different cases. Use the table below to determine which type of metric you should create based on your goal:

Goal

Derived Metric

Calculated Expression

Use metrics from multiple datasets

No

Yes

Use advanced functions

Yes

No

Place in a grid

Yes

No

Place in a text field

Yes

Yes

Use in conditional formatting

Yes

No

Reuse within the document

Yes

No

Create on the fly in a text field, without creating a new object and adding it to the layout

No

Yes

Metrics in the Detail section

A metric in a text field in the Detail section is displayed as it is calculated in the dataset report. To change the calculation of a metric, place it in a grid or in a text field in a different section. For example, placing a metric in the Document Footer provides a grand total.

Metrics that an analyst can define in a document include calculated expressions, derived metrics, and summary metrics. They are created in the document, not in the dataset report. However, like other metrics, they are calculated at the level of the dataset.

Metrics in grouping sections

When you place a metric in a text field in a group header or footer, the metric is totaled at the level of the group. Grouping allows you to specify the attribute, consolidation, or custom group to use to calculate the metric. Like other metrics, a derived metric is calculated at the level of the group.

The calculation of the group total is determined by the metric's definition, specifically by the dynamic aggregation function. See Dynamic aggregation in documents below.

Summary metrics explicitly set the aggregation function; this is their primary role. For other user-defined metrics, the function specified in the definition is also used as the aggregation function, if the function is SUM, MIN, or MAX.

Metrics in document/page sections

When you place a metric in a text field in the Document Header/Footer or the Page Header/Footer, the metric is totaled across the entire dataset. Like grouping sections, the calculation of these pages and grand totals are determined by the metric's dynamic aggregation function. In the case of user-defined metrics, the function specified in their definition is used as the aggregation function if the function is SUM, MIN, or MAX. See Dynamic aggregation in documents below.

Metrics in a Grid/Graph in grouping sections

When you place a metric in a Grid/Graph control that is in a group header or footer, the metric is calculated at the level defined by the attributes, consolidations, or custom groups on the Grid/Graph. Additionally, the level of the grouping section is taken into account, but only for those group fields that exist on the dataset to which the Grid/Graph belongs.

If the Grid/Graph does not contain any objects other than the metric, the metric behaves as though it were in a text field in the same section. As with metrics in text fields in grouping sections, the calculation is determined by the metric's dynamic aggregation function. In the case of user-defined metrics, the function specified in their definition is used as the aggregation function if the function is SUM, MIN, or MAX. See Dynamic aggregation in documents below.

Metrics in a Grid/Graph in document/page sections

When you place a metric in a Grid/Graph control that is in the Document Header/Footer or the Page Header/Footer, the metric is calculated at the level defined by the attributes, consolidations, or custom groups on the Grid/Graph. If the Grid/Graph does not contain any objects other than the metric, the metric behaves as though it were in a text field in the same section. As with metrics in text fields in grouping sections, the calculation is determined by the metric's dynamic aggregation function. In the case of user-defined metrics, the function specified in their definition is used as the aggregation function if the function is SUM, MIN, or MAX. See Dynamic aggregation in documents below.

Dynamic aggregation in documents

Dynamic aggregation occurs in documents when you place a text field or a Grid/Graph control containing a metric in a section header or footer, that is anywhere except in the Detail section. The function used in this aggregation is set in the metric definition.

Compound metrics follow the same rules for aggregation. If a compound metric does not use a SUM, MIN, or MAX function, and the dynamic aggregation function is set to default, a null value is generated when the compound metric is placed in a section header or footer (that is, anywhere other than the Detail section). To trigger dynamic aggregation, specify the function to use for calculation.

In the case of user-defined metrics, the function specified in their definition is used as the aggregation function if the function is SUM, MIN, or MAX.

Related topics