Focal Point
Supress Grand Totals for certain columns

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1331077331

February 26, 2004, 09:19 PM
RB
Supress Grand Totals for certain columns
Hi,

I want to know if there is any command to supress grand totals for certain columns.

For example, I have C1 C2 C3 C4 C5 columns
I am doing sub-total by C1
I want the output to be

C1 C2 C3 C4 C5
a 1 2 3 4
5 5 5 5
total for a 6 7 8 9
-------------------------------
b 6 6 6 6
total for b 6 6 6 6
-------------------------------
total(for c2 and c4) 12 14

I want to supress the grand total for C3 and C5.

Any ideas?
February 27, 2004, 11:21 AM
<mhuber>
You can't suppress grand totals directly, although you can achieve the same effect. Basically, if you have a common value across all rows in the table, you can subtotal on this, and achieve a grand total.

Below you'll see examples using DEFINE and COMPUTE. Basically, the only difference is BY TOTAL with the compute field.

Regards,
Michael

-***********DEFINE
DEFINE FILE CAR
SPACE/A1 WITH COUNTRY = ' ';
END
TABLE FILE CAR
PRINT
SALES
DEALER_COST
SEATS
RETAIL_COST
BY SPACE NOPRINT
BY COUNTRY
ON COUNTRY SUBTOTAL
SALES
DEALER_COST
SEATS
RETAIL_COST
AS 'SUBTOTAL'
ON SPACE SUBTOTAL
DEALER_COST
RETAIL_COST
AS 'GRAND TOTAL'
ON TABLE NOTOTAL
END

-***********COMPUTE
TABLE FILE CAR
PRINT
COMPUTE SPACE/A1 = ' '; NOPRINT
SALES
DEALER_COST
SEATS
RETAIL_COST
BY TOTAL SPACE NOPRINT
BY COUNTRY
ON COUNTRY SUBTOTAL
SALES
DEALER_COST
SEATS
RETAIL_COST
AS 'SUBTOTAL'
ON SPACE SUBTOTAL
DEALER_COST
RETAIL_COST
AS 'GRAND TOTAL'
ON TABLE NOTOTAL
END
February 27, 2004, 11:43 AM
<mhuber>
oops... that's what I get for not testing my code before I post it.

It doesn't seem to be working because we're subtotalling on COUNTRY as well as on SPACE.

I'll have to give this more thought...
-Michael
February 27, 2004, 04:52 PM
susannah
RB, you can specify just the grandtotals that you want in your SUMMARIZE line.
ON TABLE SUMMARIZE C1 C2 C4
This line overrides the default grandtotals provided to you by your subtotalling activity.
March 01, 2004, 08:35 PM
RB
Hi Susannah,
Summarize command did not work. It overrides even the subtotals.
I used the summarize command as
ON TABLE SUMMARIZE C2 C4
Now I get the output as
C1 C2 C3 C4 C5
a 1 2 3 4
5 5 5 5
total for a 6 8
-------------------------------
b 6 6 6 6
total for b 6 6
-------------------------------
total(for c2 and c4) 12 14

I need to get the subtotal for all the columns C2 C3 C4 C5, grand totals for C2 and C4.
March 02, 2004, 04:40 PM
susannah
Rb, you need both commands, SUBTOTAL as you had it, and SUMMARIZE as you needed it.
TABLE FILE CAR
SUM SEATS WEIGHT BY COUNTRY BY MODEL
ON COUNTRY SUBTOTAL
ON TABLE SUMMARIZE SEATS
END
March 02, 2004, 05:29 PM
RB
Susannah,
I included the subtotal comamnd when I used summarize command. But it did not work. I used styling option.
ON TABLE SET STYLE *
TYPE=GRANDTOTAL, COLOR = WHITE, COLUMN=C3,\$
TYPE=GRANDTOTAL, COLOR = WHITE, COLUMN=C5, \$
END STYLE
This hides the grandtotal of C3 and C5 as color of the output is same as the background color.
This is not a very good solution though. But it works.