Options for summing columns

Several options are available when defining formats and columns that can impact if and how data is totaled in the columns of a report. These options are discussed earlier in this guide, but are summarized here.

Defining subtotals and grand totals on a report

If you want to include subtotals or grand totals within a report column, then you must define a Total row line. Use total levels on the row line to indicate what data you want to include in the subtotal or grand total. See Total line type.

Totaling columns

When you define a new format, the value you select in the Totaling field on the Define Format (RW20.2) subform impacts how the column totals appear on the report. The default value for this field is Sum Down, which means that the net or rounded result of each value is added to create the total.

As an option you can select Recalculate to total a column. Recalculate only uses values from the primary format (format 1) except when used in conjunction with the COLM or PCTBAS data dictionary names. Use this option to recalculate a total for a percentage column, such as a percent-of-sales column on an income statement. The application recalculates the percentage for the total instead of summing the percentages on the lines above the total. If you do not want to print totals for a column, then select Do Not Print in the Totaling field.

See Defining formats.

Producing totals for columns with different data types

Use the Total Option field on the Options tab on Report Writer (RW00.1) to indicate whether totals are maintained by format. The default setting is Yes - By Format, but you can select No to maintain net totals. This option is important if you are using multiple formats in a report.

Note: You should also make sure that the column numbers in the formats are the same for the totals to cross formats. For example, if you have CYDAMT in column number 15 for format 1, but in column number 11 for format 2, then the CYDAMT will not add together. CYDAMT must be in the same column number in each format or they will not add together.

Consider this example where one column contains two formats: current year-to-date amounts and current year-to-date units. If you select No - Net Totals as your total option, then the total includes all formats in the column and would combine amounts and units in the totals for the column.

When you select Yes - Total by Format, individual totals are maintained for each format in the column. In this example, you can see the total amount separately from the total units.


              
              
       SALES

Sales-Prescription Drugs (Amount)              $12,600,000
Sales-Prescription Drugs (Units)                     5,000

Sales-Non-Prescription Drugs (Amount)           10,300,000
Sales-Non-Prescription Drugs (Units)                 2,000
                                             --------------

       TOTAL                                   $22,907,000

            

              
              
       SALES

Sales-Prescription Drugs (Amount)              $12,600,000
Sales-Prescription Drugs (Units)                     5,000

Sales-Non-Prescription Drugs (Amount)           10,300,000
Sales-Non-Prescription Drugs (Units)                 2,000
                                             --------------

       TOTAL (Amount)                          $22,900,000
       TOTAL (Units)                                 7,000

            

Excluding a line from a total

By default, all row lines with numeric values are included in a column total. As an option, you can click More next to a row line to access the Additional Information (RW10.6) subform where you can indicate if you want to exclude or subtract the line from the column total.

See ydh1584502291659.html##F_15691x3Ax20H2x3Ax20Definingx20anx20Accountx20Rowx20x28Stylex201x20, Defining a level row (Style 2 reports), and Defining report parameters for a Style 2 report.

Summing multiple columns

You can add together the values in two or more columns, displaying the results in a new column, using the COLM data dictionary name. This dictionary name requires column parameters to specify which columns amounts are to be summed. For example, COLM(2-6) would sum amounts in columns two through six. See Data dictionary.