As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name. Connect to myibi
Focal Point    Focal Point Forums    WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Finding out a total for a ROW for only negative values.

 Go Search Notify Tools
 [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