Breaking on a value to add subtotals

To include subtotals in the report, specify a BREAK usage code that tells QMF where to make a break in the report and calculate a subtotal.

The BREAKn usage code divides the report whenever the value of the associated column changes. Control breaks are the points at which a report breaks. Control columns are the columns that govern control breaks. You can have up to six breaks in a report. To indicate a break, you type the word BREAK and follow it with a number from 1 to 6.

In this example, you add a break to one column to divide the report every time the department number changes.

Because you want to show subtotals by department (calculate a subtotal whenever the department number changes), specify the break usage code in the DEPT_NUMBER column. Therefore, the DEPT_NUMBER column is the control column.

To add subtotals:

  1. On the FORM.COLUMNS panel, move the cursor to the USAGE field for the column you want to use as the control column.
  2. For this example, type BREAK1 for the DEPT_NUMBER column.
    Figure 96. Create breaks for subtotals in your report on FORM.COLUMNS.
     FORM.COLUMNS                                           MODIFIED
     
                            Total Width of Report Columns: 64
      NUM COLUMN HEADING                           USAGE   INDENT WIDTH EDIT  SEQ
      --- ---------------------------------------- ------- ------ ----- ----- ---
        1 EMPLOYEE_NAME                                    4      9     C     3
        2 DEPT._NUMBER                             BREAK1  2      6     L     1
        3 JOB                                      OMIT    4      5     C     2
        4 SALARY                                   SUM     2      12    D2    4
        5 COMMISSIONS                              SUM     2      11    D2    5
        6 TOTAL_EARNINGS                           SUM     4      12    D2    6
          *** END ***
  3. Press the Report function key to display the changed report.
    Figure 97. The changed report shows a subtotal after each department.
       DEPT.     EMPLOYEE                                     TOTAL
       NUMBER      NAME           SALARY  COMMISSIONS        EARNINGS
       ------    ---------  ------------  -----------    ------------
         15      KERMISCH     $12,258.50      $110.10      $12,368.60
                 NGAN         $12,508.20      $206.60      $12,714.80
                 ROTHMAN      $16,502.83    $1,152.00      $17,654.83
                            ------------  -----------    ------------
                         *    $41,269.53    $1,468.70      $42,738.23
     
         20      JAMES        $13,504.60      $128.20      $13,632.80
                 PERNAL       $18,171.25      $612.45      $18,783.70
                 SNEIDER      $14,252.75      $126.50      $14,379.25
                            ------------  -----------    ------------
                         *    $45,928.60      $867.15      $46,795.75
     
         38      ABRAHAMS     $12,009.75      $236.50      $12,246.25
                 NAUGHTON     $12,954.75      $180.00      $13,134.75
                 O'BRIEN      $18,006.00      $846.55      $18,852.55
                 QUIGLEY      $16,808.30      $650.25      $17,458.55
                            ------------  -----------    ------------
                         *    $59,778.80    $1,913.30      $61,692.10
     
                            ============  ===========    ============
                             $146,976.93    $4,249.15     $151,226.08

For more information on specifying control breaks, see the QMF Reference .

[ Previous Page | Next Page | Contents | Index ]