Focal Point
Recompute or Subtotals by multiple fields

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

January 28, 2008, 03:02 PM
Latigresa
Recompute or Subtotals by multiple fields
I am wanting to get the total by 2 othe fields. I am not able to to do or should I say figure it out.

PRINT
MBR_NAME
MBR_NBR_TXT AS 'Customer,No.'
MBR_STAT_DESC AS 'Customer,Status'
POL_NBR_TXT AS 'Policies'
POL_TYPE_TXT AS 'Policy,Line of,Business'
POL_STAT_DESC AS 'Policy,Status'
Gained
Lost
BY DIST_CD AS 'Dist'
BY AGCY_CD AS 'Agency'
BY AGT_CD_TXT AS 'Wrt Agt,as of,Jan 1'
BY Gained NOPRINT
BY Lost NOPRINT

ON AGT_CD_TXT RECOMPUTE
SUM. Gained
SUM. Lost AS '*TOTAL'
ON TABLE SUBHEAD

Results...
Dist Agency WrtAgtJan 1 CustName CustNo. Customer Status Policies PolicyLinofBus PolicySta Gained Lost
1 9 14789 KODY KITCHENS B6NF PAID 21511154 SM INACTIVE 0 -1
LUIS CARLOS SAENZ VD6W BILLED 278593 HO INACTIVE 0 -1
LUIS CARLOS SAENZ VD6W BILLED 418254 HO INACTIVE 0 -1

*TOTAL 14789 0 -3

But the result should only be counting by Agent and by Member No. not by policy. The *Total should be 0 and -2. Can someone out there PLEASE help me??

Ana


WEBFOCUS 7.6.4
Server: WINXP
January 28, 2008, 03:10 PM
susannah
Latigresa
learn to use the [ code ] tags, so we can read your stuff, sans ageda.
Member No isn't a BY field in your report, Policy seems to be.
Gained and Lost are referenced twice in your extract, making it unclear which is being pulled in your recompute.
Replicate your report on the CAR file, so we can replicate and correct it for you.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 28, 2008, 03:12 PM
Latigresa
OK..I redid this whole thing to where it WAS READABLE but when I clicked ok it changed it all...I AM NEW TO ALL THIS AND THAT IS WHY I AM ON HERE ASKING FOR HELP! THANK YOU!!


WEBFOCUS 7.6.4
Server: WINXP
January 28, 2008, 03:42 PM
Leah
When posting insert your code between the 'code' tags Also, are you wanting subtotals. There is subtotal and sub-total. One will give sub-totals on all 'by's' after the value. Try a summarize or recompute on each by field you want.


Leah
January 28, 2008, 04:09 PM
Latigresa
What if the results is by 2 field together instead each? I think as usual I have not worded it correctly. Sweating The total I am wanting is a combination of by Member Number and by Agent Code for the Gain and Loss fields. If Agent Code 123 has 3 Memeber Number but one or more of those members has several policies I want it to count the Member Number only once. Right now it is counting each policy instead of each member number. Hope you are able to understand what I am trying to do. Confused


WEBFOCUS 7.6.4
Server: WINXP
January 28, 2008, 04:33 PM
Prarie
I'm not sure exactly what you want ...but try changing your print to a SUM


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
JOIN
 MKCUSTRPTGL.SEG01.AGCY_CD IN MKCUSTRPTGL TO MULTIPLE MKCUSTCNTGL.SEG01.AGCY_CD
 IN MKCUSTCNTGL AS J1
 END
DEFINE FILE MKCUSTRPTGL
Gained/I2=IF CUST_CHNG_TXT EQ 'GAIN' THEN 1 ELSE 0;
Lost/I2=IF CUST_CHNG_TXT EQ 'LOSS' THEN -1 ELSE 0;
BEG_DAY/YYMD=DATEMOV(RPT_DT, 'BOM');
END_MONTH/YYMD=DATEMOV( RPT_DT, 'EOM');
CURR_YR/YY=DATEMOV( RPT_DT, 'YY');
CURR_MON/M=DATEMOV(RPT_DT, 'M');
CURR_DATE/TRMDYY=RPT_DT;
CUR_MON_1/TRM=CURR_DATE;
Mon_Day/JUL=RPT_DT;
END
TABLE FILE MKCUSTRPTGL
SUM 
     MBR_NBR_TXT AS 'Customer,No.'
BY DIST_CD AS 'Dist'
BY AGCY_CD AS 'Agency'
BY AGT_CD_TXT AS 'Wrt Agt,as of,Jan 1'
BY MBR_NAME AS 'Customer,Name'
SUM 
     AVE.Gained AS 'AVE,Gained'
     AVE.Lost AS 'AVE,Lost'
BY DIST_CD AS 'Dist'
BY AGCY_CD AS 'Agency'
BY AGT_CD_TXT AS 'Wrt Agt,as of,Jan 1'
BY MBR_NAME AS 'Customer,Name'
BY MBR_STAT_DESC AS 'Customer,Status'
BY POL_NBR_TXT AS 'Policies'
BY POL_TYPE_TXT AS 'Policy,Line of,Business'
BY POL_STAT_DESC AS 'Policy,Status'

ON AGT_CD_TXT SUBTOTAL
     SUM. Gained
     SUM. Lost AS '*TOTAL'
ON TABLE SUBHEAD
"<CURR_YR   AGENT CUSTOMERS GAINED AND LOST DETAIL"
"DOES NOT INCLUDE NEW CUSTOMERS"
"FOR <CUR_MON_1 "
"Print Date:<+0>&DATEMDYY<+0> "
WHERE CUST_CHNG_TXT NE 'NEW';
WHERE CNT_TYPE_TXT EQ 'AGT';
WHERE RECORDLIMIT EQ 2000
ON TABLE SET PAGE-NUM OFF
ON TABLE SUMMARIZE AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


Here is the revised code...it gives me the totals for all policies instead of just by Member No per Agent code.

Thank you for helping me..

Ana

This message has been edited. Last edited by: Latigresa,


WEBFOCUS 7.6.4
Server: WINXP
I have tried to create what I think you want, using the car file. Can you tell me if this is close to your requirements:
DEFINE FILE CAR
CNTR WITH MODEL=1;
CNTR2 WITH CAR=1;
END
TABLE FILE CAR
SUM CNTR2 NOPRINT
BY COUNTRY
SUM CNTR 
BY COUNTRY
BY CAR
BY MODEL
ON COUNTRY SUBFOOT
"TOTAL CARS <CNTR2"
END

as i think you want a count rather than a SUM.


Alan.
WF 7.705/8.007
I was able to get the results I needed by moving the 2 last fields next to the Member Number and I am now getting the correct results. For some reason when I move them to the end it starts to count by policy even though it is set to details...

Thanks everyone for all your help!!

Have a great evening!!

Ana


WEBFOCUS 7.6.4
Server: WINXP