I have report request where report has three by fields and first by field doing subtotal. Need to show other subgroup records only on certain values otherwise show the subtotal values. For example CAR file. First group is Country and has two subgroups CAR and model and sum the sales. Want to show the everything when county is England and Japan otherwise show only subtotal for France and other countries
WF 7.7.3 and Windows.This message has been edited. Last edited by: Kerry,
November 15, 2012, 04:06 AM
atturhari
Here's an example,
TABLE FILE CAR SUM SALES BY COUNTRY SUBTOTAL WHEN COUNTRY EQ 'ENGLAND' BY CAR SUBTOTAL WHEN COUNTRY EQ 'ENGLAND' END
WF 7.7.02 on Windows 7 Teradata HTML,PDF,EXCEL,AHTML
November 15, 2012, 02:19 PM
Vir
Thank you for your suggestion.
But I want to show the CAR and Model if the Country is Equal to England and Japan. For France and other countries show only subtotal sales for this countries and no car and model.
TABLE FILE CAR SUM CAR.BODY.SALES BY CAR.ORIGIN.COUNTRY BY CAR.COMP.CAR BY MODEL BY COUNTRY SUBTOTAL END
November 15, 2012, 03:39 PM
Danny-SRL
Vir, Here is one solution.
DEFINE FILE CAR
CAR=IF COUNTRY EQ 'ENGLAND' OR 'JAPAN' THEN CAR ELSE ' ';
MODEL=IF COUNTRY EQ 'ENGLAND' OR 'JAPAN' THEN MODEL ELSE ' ';
END
TABLE FILE CAR
SUM SALES
BY COUNTRY BY CAR BY MODEL
ON COUNTRY SUBTOTAL MULTILINES
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
November 15, 2012, 04:26 PM
Vir
Thanks it works fine !
Just minor thing to it, is it possible to hide the detail data for France,Italy or other countries to show only as subtotal. Like Total England, shows as Total France and Total Italy.
Thanks.
November 15, 2012, 11:39 PM
Ram Prasad E
As Daniel suggested, using DEFINE, COMPUTE, WHEN you should be able to achieve this.
DEFINE FILE CAR
XCOUNTRY/A20=COUNTRY;
END
TABLE FILE CAR
SUM SALES
BY COUNTRY BY XCOUNTRY BY CAR BY MODEL
WHERE COUNTRY EQ 'ENGLAND' OR 'JAPAN'
ON TABLE HOLD AS VIR FORMAT ALPHA
END
FILEDEF VIR DISK VIR.FTM (APPEND
DEFINE FILE CAR
CAR=' ';
MODEL=' ';
XCOUNTRY/A20 ='Total ' | COUNTRY;
END
TABLE FILE CAR
SUM SALES
BY COUNTRY BY XCOUNTRY BY CAR BY MODEL
ON TABLE SAVE AS VIR
END
TABLE FILE VIR
PRINT CAR MODEL SALES
BY COUNTRY NOPRINT
BY XCOUNTRY AS COUNTRY
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF