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.
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.
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.
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 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.
Pause the pointer over the query explorer button and click the query that you want.
In the Properties pane, set the Auto Group & Summarize property to the value that you want:
To group non-aggregate fact data items and apply aggregate functions to aggregate fact data items in lists, set this property to Yes.
To render detail rows, set this property to No.
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.
Open the report that you want.
Click the column to which you want to add a summary.
From the Data menu, click the kind
of summary that you want
.
If you want to change the summary label, do the following:
Click the label.
In the Properties pane, click the Source Type property and then click the source type that you want to use to define the label.
For example, click Data Item Value to produce a dynamic label for the summary based on data item values.
Depending on the source type you chose in the previous step, click the property below Source Type and specify the label.
For example, if clicked Data Item Value as the source type, click the Data Item Value property and click the data item that you want to use to define the label.
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
.
If you want to change a summary, click
it, and in the Properties pane, under Data Item,
click Rollup Aggregate Function and
choose a different function.
In crosstabs, you can add multiple summaries at the same level. For example, you have a crosstab with Product line as rows, Order year as columns, and Revenue as the measure. For Product line, you can add the Total summary as a header, which will total all revenue for each order year. You can then add the Average summary as a footer, which will give the average revenue of all product lines for each order year.
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 .
Click the data item for which you want to set detail or summary aggregation.
In the Properties pane, set the Aggregate
Function or the Rollup Aggregate Function property
to the function that you want .
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:
The underlying data source is relational and you want to use database vendor-specific aggregate functions.
You want to use aggregate functions that require more than one parameter, such as percentile.
You require aggregate expressions that are not available in the aggregation properties, such as a for clause.
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])
Click the data item that you want.
In the Properties pane, double-click the Expression property.
Add the aggregate functions that you want to the expression for the data item.
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.
From the Tools menu, click Options.
Click the Edit tab.
Click Aggregation mode and select
the aggregation mode that you want to use.
Click OK.
In crosstabs and charts, aggregated values are calculated using one of the following aggregate expressions:
aggregate(measure within set set expression)
Aggregates the member values from the data source within the current content.
aggregate(measure within detail data item)
Aggregates the lowest level of details in the report.
aggregate(measure within aggregate data item)
Aggregates each level of details in the report.
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:
Total ([Revenue] within set [Quarter])
This expression totals the quarter values from the data source at the intersecting product line. At the bottom right corner, it totals the aggregate over all product lines for each quarter.
Total ([Revenue] within detail [Quarter])
This expression totals the month values visible in the report at the intersecting product line. At the bottom right corner, it totals all of the intersecting month - product line values visible in the report.
Total ([Revenue] within aggregate [Quarter])
This expression totals the month values visible in the report at the intersecting product line into quarters. At the bottom right corner, it does the same, but starting with the aggregate over all product lines for each month.
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.
Average(Product line) - within detail
This summary is the average of the detail values in the crosstab.
Average(Product line) - within aggregate
For each product line, the average of the detail values is calculated. This is equivalent to applying the average aggregation function to the Product type column. This summary is the average of the product type averages.
Average(Product line) - within set
This summary is the average of the product type values rolled up into sets at the Product line level. The values are obtained from the data source. If filters or slicers exist, the values are recomputed using the aggregation rules defined in the data source.
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.
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.