Summary functions

The following are functions that can be used for creating summaries. They are divided into two types: normal functions and running functions.

A normal function calculates all records and returns only one fixed value.

A running function calculates a value on each record dynamically. It is like the total sum of money for each transaction that is recorded on your checkbook. Each time you deposit or withdraw money from the bank, the record will compute the total of your checking account balance.

Examples

The following are two examples comparing normal functions and running functions.

Sum on banded object

Summaries can be added in a banded object as columns which makes the comparison quite obvious.

The first page of a banded object:

The last page of the banded object:

As revealed in the first and last pages of the banded object, the sum on quantity is always the same value which is a total quantity of all the records, while running sum on quantity is the current accumulated value on each row.

Sum on crosstab

  1. Open the catalog file SampleReports.cat.
  2. Click File > New > Web Report on the menu bar.
  3. Drag Crosstab from the Toolbox panel to the web report. The Create Crosstab wizard appears.
  4. In the Data screen of the wizard, select SaleStat from Data Source 1. Then click Next.
  5. In the Display screen, add the DBField Assigned Region to the Columns box and Year to the Rows box.
  6. In the Dynamic Resources > Aggregations node, click <Add Aggregation...>.
  7. In the Add Aggregation dialog, input Sum_Quantity in the Aggregation Name text field, click beside the Mapping Name text field and select Quantity as the mapping name, then select Sum as the aggregate function and click OK.

  8. Repeat the step above to create another aggregation named RunningSum_Quantity, also use Quantity as the mapping name, and specify the aggregate function as RunningSum.

  9. Add the two newly created dynamic aggregations as the summary fields.

  10. Switch to the Style screen and select Basic as the report style. Click Finish.
  11. To distinguish the two kinds of sum functions, select the four summary fields which use RunningSum as the aggregate function and set their Background property to Green.

  12. Click the View tab. The running sum values are highlighted in green for easier comparison. Note that the running functionality is only for columns of the crosstab, it does not do running totals on the rows.