Focal Point
[SOLVED] Finding out a total for a ROW for only negative values.

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

August 23, 2016, 11:56 AM
Petter
[SOLVED] Finding out a total for a ROW for only negative values.
I need to compute the a total for each row but only the negative values. In the example below, part AAAA does not have negative values in OH1 and OH2 so the total is 0 (or null). l if possible). Part BBBB has negative values in OH1 and OH2 is -5. Part CCCC has only one negative value in OH1 so the total is -4. Part DDDD has a negative value OH2 so the total is -03. I included the leading zeros in the example below just to keep the formatting. I have also included only two OHx fields but my report has 8 OHx fields.

Part OH1 OH2 TOT
AAAA 005 001 000
BBBB -03 -02 -05
CCCC -04 005 -04
DDDD 006 -03 -03

I appreciate your help.

Petter

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


WebFocus 7703
Windows, All Outputs
August 23, 2016, 01:00 PM
Dan Satchell
Maybe something like this:

TABLE FILE xxxx
 SUM/PRINT
  OH1
  OH2
  OH3
  .
  .
  .
  COMPUTE OH1X/D9 = IF (OH1 LT 0) THEN OH1 ELSE 0 ;  NOPRINT
  COMPUTE OH2X/D9 = IF (OH2 LT 0) THEN OH2 ELSE 0 ;  NOPRINT
  COMPUTE OH3X/D9 = IF (OH3 LT 0) THEN OH3 ELSE 0 ;  NOPRINT
  .
  .
  .
  COMPUTE TOT/D9 MISSING ON = IF   (OH1X + OH2X + OH3X + .....) EQ 0 THEN MISSING
                              ELSE (OH1X + OH2X + OH3X + .....);
 BY PART
END



WebFOCUS 7.7.05
August 24, 2016, 09:36 AM
Petter
Thank you! It did work!


WebFocus 7703
Windows, All Outputs