> ## Aggregating Data

> One of the key features of any report is the ability to display summary, or aggregate, information. For example, a sales report can show the overall sales total; sales subtotals by product type, region, or sales representatives; average sales figures; or the highest and lowest sales figures.

> Aggregating data involves performing a calculation on a set of values rather than on a single value. For a simple listing report, aggregate calculations are performed on values in a specific field, over all the data rows in the report.

> BIRT calculates an average payment in a report by adding the values in the Amount field in every row, then dividing the total by the number of rows.

> #### How to display aggregate data

> 1 | On the palette, under Quick Tools, drag an aggregation element and drop it in the header or footer row of a group or a table.

> 2 | On Aggregation Builder:

> 1 | In Column Binding Name, type a unique name. Remember, for each piece of calculated data to display in a report, there must be a column binding.

> 2 | In Data Type, select the type of the aggregate value.

> 3 | In Function, select an aggregate function.

> 4 | In Data Field, do one of the following:

> o | Select a data set field whose values to perform the aggregate calculation.

> o | If performing an aggregate calculation on values other than values in a data set field, type an expression. You can open the expression builder to get help constructing an expression.

> 5 | In Filter Condition, specify the filter condition to use to determine which rows are factored in the aggregate calculation.

> 6 | In Aggregate On, select either table or a specific group:

> o | Select table to perform the aggregate calculation over all the rows in the table.

> o | Select a specific group to perform the aggregate calculation over all the rows in the selected group.

> Figure 9‑1 shows an example of a complete definition for an aggregation element. In the example, the element returns the number of rows in the table, where the extended price of the product is greater than $5,000.00.

> Figure 9-1 | Aggregation Builder displaying values for getting the count of products in the table

> 7 | Choose OK.

> In the report design, the aggregation element displays the sigma symbol followed by the column binding name, as shown in the following example:
> [Total_Products]

> 3 | Preview the report to verify the results of the aggregation.

(c) Copyright Actuate Corporation 2008