Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row total and column total on specific columns only?

Status
Not open for further replies.

ntgallo

Programmer
Mar 31, 2003
1
US
I am trying to generate a matrix report using BY and ACROSS.
The code below gives me what I want with some extra information. It not only sums up tons but also percent for every row of data. So grand total includes ROW-TOTAL for tons and ROW-TOTAL for percent.
Similarly COLUMN-TOTAL sums every column in the matrix.

TABLE FILE CRDATA
SUM
CRTONS AS 'TONS'
AND ROW-TOTAL AS 'GRAND TOTAL'
PERCNT AS 'PERCENT'
BY
GRT AS 'GROUP'
ACROSS
SITE_N AS 'SITE'
ON TABLE COLUMN-TOTAL

Is there any way to total just one specific column in ROW-TOTAL and COLUMN-TOTAL.

Thanks in advance for help
 
With the COLUMN-TOTAL there should be no problem. You can use the syntax
Code:
ON TABLE SUBTOTAL column_name AS 'Title'
or use SUBFOOT to have even more control on values displayed in the report. With ACROSS there is not so easy, the only thing I can find is to use the column notation C1 + C3 + ..., in order to sum only the 'TONS' values, and then use RECAP to display the sum as GRANDTOTAL.
Your report could look similar to:

Code:
TABLE FILE CRDATA
SUM
    CRTONS AS 'TONS'
    PERCNT AS 'PERCENT'
BY
    GRT AS 'GROUP'
ACROSS
    SITE_N AS 'SITE' RECAP TOTAL/D12.2 =
-REPEAT :LOOP FOR &VAR FROM 1 TO 253 STEP 2;
  C&VAR +
-:LOOP
  C255;
ON TABLE SUBTOTAL CRTONS AS 'TONS TOTAL'

Hope this helps
Grzegorz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top