Focal Point
How to selectively subtotal cells from a column?

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

October 18, 2006, 09:46 AM
ibidevelop
How to selectively subtotal cells from a column?
Hi,

I'm a newbie and I had a quick question. I need to selectively have the values of particular cells of a column added to the subtotal. For example, say I have 3 columns, month this year(MonthTY), month last year(MonthLY), and pages(Pages). If the MonthLY is not the same as the MonthTY in any given record, then I don't want the pages for that record added to the total when I issue my RECOMPUTE. I would want the following results:

MonthTY MonthLY Pages
------- ------- -----
Apr Apr 2
Apr Apr 3
Apr Apr 4
Apr May 5
Apr May 6
Apr Apr 7
Apr May 8
Apr Apr 9
----
Total 25

The total of 25 pages is only from records where MonthTY and MonthLY are the
same. This is what I need to know how to do, instead of the default which
calculates all cells of a numeric column:

MonthTY MonthLY Pages
------- ------- -----
Apr Apr 2
Apr Apr 3
Apr Apr 4
Apr May 5
Apr May 6
Apr Apr 7
Apr May 8
Apr Apr 9
----
Total 44


The default method calculates the values of all cells in the Pages column. I need to only add those specific pages to the total AND STILL HAVE THOSE PAGES DISPLAYED even though their number is not part of the total.

Is this possible? Anyone have any samples of how this can be done?

Thanks in advance,

Joe
October 18, 2006, 11:29 AM
reFOCUSing
is this what you are looking for?
TABLE FILE CAR
PRINT
  CAR 
  COMPUTE LAST_CAR/A16 = LAST CAR;
  SEATS
  COMPUTE VALID_SEATS/I3 = IF CAR EQ LAST_CAR THEN SEATS ELSE 0; NOPRINT
ON TABLE SUBFOOT
"TOTAL <CT.VALID_SEATS"
END
-RUN

October 26, 2006, 08:53 AM
ibidevelop
Sorry for late reply. That is what I've been told I have to settle for. I was hoping that I could do it without having to now position every field in the SUBFOOT, but if that is the only way then that is the only way.

Thanks,

Joe