Had to use some grey cells for this, but you can do it using FRL (etc. etc.) and a couple of passes of the data.
This solution makes use of the "WHEN EXISTS" syntax of FRL and when building up the data I specifically do not create a value for the subtotal of the percentage field so that the FRL syntax omits the final line as required.
First pass summates the CCOUNT values by MODEL and COUNTRY and also adds a couple of COMPUTED fields to help with positioning in the final report.
The second pass provides the same but substitutes a single value so that the summation produces a single row of output for the subtotal.
The third and final pass summate the PCT.DEALER_COST WITHIN MODEL.
As the hold file used is set-up in append mode all the data is combined when held soo that it can easily be used in a single FRL report.
APP FI TEMPHOLD DISK TEMPHOLD.FTM (APPEND
DEFINE FILE CAR
CCOUNT/D6 WITH MODEL = 1;
MODEL_ST/A24 = 'Subtotal';
END
TABLE FILE CAR
SUM CCOUNT AS 'Count'
COMPUTE ROW_NUM/I1 = 1;
SORT_ORD/I1 = 1;
BY COUNTRY
BY MODEL
ON TABLE HOLD AS TEMPHOLD
END
TABLE FILE CAR
SUM CCOUNT
COMPUTE ROW_NUM/I1 = 1;
SORT_ORD/I1 = 2;
BY COUNTRY
BY MODEL_ST
ON TABLE HOLD AS TEMPHOLD
END
TABLE FILE CAR
SUM PCT.DEALER_COST WITHIN MODEL
COMPUTE ROW_NUM/I1 = 2;
SORT_ORD/I1 = 1;
BY COUNTRY
BY MODEL
ON TABLE HOLD AS TEMPHOLD
END
TABLE FILE TEMPHOLD
SUM DEALER_COST
BY SORT_ORD NOPRINT
BY MODEL
ACROSS COUNTRY
FOR ROW_NUM
1 WHEN EXISTS AS '' OVER
2 WHEN EXISTS AS ''
END
Messy, but I hope this helps
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |