July 12, 2007, 01:52 AM
AnatessACROSS-TOTAL not working...
Can somebody tell me why the ACROSS-TOTAL on this example doesn't work?
TABLE FILE CAR
SUM
DEALER_COST AS 'DEALER COST'
RETAIL_COST AS 'RETAIL COST'
COMPUTE SUMCOST/D9=DEALER_COST+RETAIL_COST; AS 'SUM COST'
BY SEATS
ACROSS BODYTYPE
ACROSS-TOTAL AS 'COST TOTAL'
WHERE TOTAL SUMCOST NE 0;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END
For some reason, the ACROSS-TOTAL value when the last ACROSS data is 0 (nodata) is also nodata even if the first few ACROSS data is greater than 0. If the last ACROSS value is greater than 0 then the ACROSS-TOTAL is okay. What should be the proper way of coding this scenario?
July 12, 2007, 03:51 AM
FrankDutchAnatess
Does the command ROW-TOTAL give you the same result?
July 12, 2007, 04:50 AM
Alan BAnatess
Frank is correct for what I think you want. ACROSS-TOTAL would work if you wanted to do something like:
TABLE FILE CAR
SUM
DEALER_COST AS 'DEALER COST'
RETAIL_COST AS 'RETAIL COST'
COMPUTE SUMCOST/D9=DEALER_COST+RETAIL_COST; AS 'SUM COST'
BY SEATS
ACROSS BODYTYPE
ACROSS-TOTAL AS 'COST TOTAL' COLUMNS SEDAN AND CONVERTIBLE
WHERE TOTAL SUMCOST NE 0;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END
From the docs:
"Row totals for horizontal sort fields, referenced by ACROSS-TOTAL, are different from standard row totals because only horizontal sort field values, referenced by ACROSS, are included in the total."
Just replace ACROSS-TOTAL with ROW-TOTAL in your example.
July 12, 2007, 07:33 AM
<JG>WHERE TOTAL SUMCOST NE 0;
Is causing the problem.
Remove that line.