Let's Get Social!
Focal Point    Focal Point Forums    WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Finding out a total for a ROW for only negative values.
 Go New Search Notify Tools Reply
 [SOLVED] Finding out a total for a ROW for only negative values.
Member
 posted August 23, 2016 11:56 AM
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

Petter

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

WebFocus 7703
Windows, All Outputs

 Posts: 11 | Registered: November 09, 2012 IP
Virtuoso
 posted August 23, 2016 01:00 PM Hide Post
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

 Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007 IP
Member
 posted August 24, 2016 09:36 AM Hide Post
Thank you! It did work!

WebFocus 7703
Windows, All Outputs

 Posts: 11 | Registered: November 09, 2012 IP