To use Cognos product documentation, you must enable JavaScript in your browser.

Summarizing Data

In a report, there can be detail and summary aggregation. The detail aggregation specifies how a data item is totaled at the lowest level in a report. In lists, the detail aggregation specifies how the values that appear in the rows are totaled. In crosstabs, the detail aggregation specifies how the values in the cells are totaled. For example, the detail aggregation for a measure like Revenue might be Total in both lists and crosstabs. In the following list report, this means that the values you see for the Revenue column represent the total revenue for each product type.

The summary aggregate specifies how data items are totaled in the headers and footers of a list and in the total rows and columns of a crosstab.

You can specify detail and summary aggregation in different ways by using any of the following:

If a summary is applied to a report that contains binary large object (BLOB) data, such as images or multimedia objects, you cannot also perform grouping or sorting.

OLAP Data Sources

Summary options depend on the data source type that you are using. If you are querying an OLAP data source, all measure values that appear in reports are pre-summarized because the data source contains rolled up values. The type of aggregate that is used is specified in the data source itself. As a result, you cannot specify a different detail aggregation in a report. The report always renders the type of aggregate that is specified in the data source.

The Type of Data

How data is aggregated also depends on the type of data that you are aggregating. Aggregation rules are applied differently to facts, identifiers, and attributes. For example, if you aggregate a data item that represents part numbers, the only aggregate rules that apply are count, count distinct, count non-zero, maximum, and minimum. For information about how to determine the type of data a data item represents, see Add Data to a Report.

Use the Aggregation Properties Set in the Model to Specify Detail or Summary Aggregation

When working with relational or dimensionally modeled relational (DMR) data sources, you can use the aggregation properties specified for the query item in the Framework Manager model instead of specifying detail or summary aggregation in the report. The model specifies the default summary function for each query item.

Aggregation functions are mapped between data sources, Framework Manager, and Report Studio .

Set the Auto Group & Summarize Property

Set the query property Auto Group & Summarize to specify whether Report Studio should group non-fact data items (identifiers and attributes) and apply aggregate functions to aggregate fact data items in lists.

If you are using an OLAP data source, data is always summarized regardless of how this property is set.

Steps
  1. Pause the pointer over the query explorer button  and click the query that you want.

  2. In the Properties pane, set the Auto Group & Summarize property to the value that you want:

Use the Aggregate Button to Add Simple Summaries

You can add simple summaries to the groups in a report by using the aggregate button in the toolbar. This button provides a subset of the aggregate functions available in Report Studio. In addition, a Custom option is available so that you can add your own aggregate function in the expression of the data item .

The aggregate button sets the rollup aggregate property for the data item to the selected summary aggregate, and places the data item into an appropriate footer. A footer is created for each group as well as an overall footer, unless they already exist.

Steps
  1. Open the report that you want.

  2. Click the column to which you want to add a summary.

  3. From the Data menu, click the kind of summary  that you want .

  4. If you want to change the summary label, do the following:

In lists, the summary appears as a footer . If the column to which you added a summary is grouped, group and overall summaries appear. In crosstabs and charts, the summary appears as a node .

Tips

Specify Aggregation Properties for a Data Item

For each data item in a report, you can specify detail and summary aggregation properties so that you can easily manage summaries without having to create complex data item expressions .

Steps
  1. Click the data item for which you want to set detail or summary aggregation.

  2. In the Properties pane, set the Aggregate Function or the Rollup Aggregate Function property to the function that you want .

Use Aggregate Functions in Data Item Expressions

You can use aggregate functions in data item expressions. The aggregate functions in the Expression Editor that have the same name as the aggregate functions available through the Aggregate Function and Rollup Aggregate Function properties operate the same way. For example, setting the Rollup Aggregate Function property to Total is the same as changing the expression of the data item to

total([Revenue])

In general, report maintenance is easier if the Aggregate Function and Rollup Aggregate Function properties are used rather than adding aggregate functions to data item expressions. Use summary functions in expressions if the required summary is not supported as an aggregate or rollup aggregate property or if the complexity of the expression cannot be managed using the data item properties. Add an aggregate function to a data item expression if one of the following conditions applies:

For example, your report uses Product line, Product type, and Quantity. You want to calculate the percentage of the parent quantity represented by each product type. This requires you to compare the total quantity for each product type to the total quantity for the parent product line. In other words, your expression requires aggregates at different group levels. You use aggregate functions in the data item expression with a for clause to specify the group level, as follows:

total([Quantity] for [Product type]) / total([Quantity] for [Product line])

Steps
  1. Click the data item that you want.

  2. In the Properties pane, double-click the Expression property.

  3. Add the aggregate functions that you want to the expression for the data item.

Specify the Aggregation Mode

If you are working with a dimensional or a dimensionally modeled relational (DMR) data source, you must specify the aggregation mode that you want Report Studio to use when aggregating data in crosstabs and charts . The aggregation mode sets the aggregation clause to be used in the data item expression.

Steps
  1. From the Tools menu, click Options.

  2. Click the Edit tab.

  3. Click Aggregation mode and select the aggregation mode that you want to use.

  4. Click OK.

Aggregating Values in Crosstabs and Charts

In crosstabs and charts, aggregated values are calculated using one of the following aggregate expressions:

You decide which aggregate expression is used by setting the aggregation mode .

For example, in the following crosstab, if you specified Total as the summary, these aggregate expressions are produced for each aggregation mode:

In simple cases, the members and values visible in the report and the aggregate rules in the report are the same as those in the data source, and all of these expressions produce the same results.

For example, for the quarter and month values, if you are totaling the values for all months in all quarters, it makes no difference whether the visible values, the values in the cube, or month and quarter values are used. The result is the same.

Different results appear when you start filtering, changing aggregation types, or use set expressions or unions.

For example, the following crosstab shows the quantity of products sold across all product types for each product line. The bottom of the crosstab has three summary values that show the average quantity of products sold by product line.

Each summary value uses a different aggregation mode that is indicated in the summary name.

In most cases, you should use the within detail aggregation mode because the results are easiest to understand, and they are the same as for footers in a grouped list report. In more complex cases, you may consider the within aggregate aggregation mode. The within set aggregation mode should be reserved for reports with a purely dimensional focus. For example, when there are no detail or summary filters defined in the report.

Aggregating Member Sets

When you work with dimensional data sources and you aggregate member sets, if an explicit summary function such as Total is used and the set contains duplicates, the result is double-counted. If you are using an OLAP data source, the result produced for the Automatic summary function depends on the data source.

For example, the product line rows below were defined using the expression

union([Product line], [Camping Equipment], ALL)

where [Product line] is the level.

The summary Aggregate(Product line) is the sum of the product lines excluding duplicates. For more information about how the Aggregate function is processed, see Summary Functions.