January 18, 2007, 08:50 AM
AshokTo have percentage % for the total generated in the report
Hi Everyone,
I have a report which works fine. I have 5 define fields which actually extracts records based on some conditions.
I have enabled column total option for this 5 define fields.
Can anyone help me in generating the percentage values for this column total and need to display the percentage values just below the total respectively.
Regards,
Ashok kumar M
January 18, 2007, 09:02 AM
FrankDutchAshok
you want something like
..........define1 define2 define3 define4 define5
total.....def1....def2....def3....def4....def5
perc.......15%.....35%.....22%.....18%.....10%
so the with a rowtotal the 15+35+22+18+10=100%
Is this what you want?
January 18, 2007, 01:27 PM
ETHere is an example using the car file.
TABLE FILE CAR
PRINT DEALER_COST SALES
BY CAR UNDER-LINE SUBTOTAL
ON CAR COMPUTE TOTAMT/P12=DEALER_COST + SALES;
COMPUTE DPCT/P6.2%=DEALER_COST / TOTAMT * 100;
COMPUTE SPCT/P6.2%=SALES / TOTAMT * 100;
ON CAR SUBFOOT
"
" "
END
CAR DEALER_COST SALES
--- ----------- -----
ALFA ROMEO 5,660 12400
5,660 13000
4,915 4800
*TOTAL ALFA ROMEO
16,235 30200
34.96% 65.04%
Good luck
January 19, 2007, 05:34 AM
AshokYes Frank.... You are right. It is the same what I am looking for. How do I accomplish this.
Thanks & Regards,
Ashok kumar
January 19, 2007, 06:16 AM
Tony AAshok,
There will be many ways to achieve this and I'm sure you'll be flooded with possible solutions.
Here's one to get you started -
TABLE FILE GGSALES
SUM DOLLARS
IF DATE FROM '19960101' TO '19971231'
ON TABLE SAVE
END
-RUN
-READ SAVE, &Tot_Dollars
DEFINE FILE GGSALES
MONTH/M = DATE;
END
TABLE FILE GGSALES
SUM DOLLARS AS 'Dollars'
OVER COMPUTE PCT_DOLLAR/D6.2% = DOLLARS / &Tot_Dollars * 100; AS 'Percentage'
ACROSS MONTH
IF DATE FROM '19960101' TO '19971231'
ON TABLE ROW-TOTAL AS 'Row Total'
ON TABLE SET PAGE-NUM OFF
END
T