Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Second Max Value
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Second Max Value
 Login/Join
 
Member
posted
Hi Experts,

I have a report that returns the Max value from 24 samples, but I need to discard the maximum value and get the second max value.

SUM MAX.UNIT_LOAD_RNC.UNIT_LOAD_RNC.PEAK_LOAD/D20 AS 'PEAK'
BY UNIT_LOAD_RNC.UNIT_LOAD_RNC.RNC_NAME

Any help appreciated,

Luciano

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


WebFOCUS 8.0.06
Windows, All Outputs
 
Posts: 3 | Registered: September 24, 2014Reply With QuoteReport This Post
Virtuoso
posted Hide Post
This example using the CAR file may help:

TABLE FILE CAR
 SUM SALES
 RANKED BY HIGHEST 2 COUNTRY
 WHERE TOTAL RNK.COUNTRY EQ 2 ;
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
Master
posted Hide Post
Dan is on the right track. I think you will have to do a HOLD with the top two values and then take the lesser of those two values for you final number.

You could also try sorting your data by the values and then use the LAST keyword to extract the value previous to the max.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Reply With QuoteReport This Post
Member
posted Hide Post
Hi guys thank both of you for the tips. We are almost there.

Unfortunetely it is not going to work.
I'll try to explain using the anology below.

For each day we have 24hours, so I need to very each hour per day and get the second max Speed for each car.

If we use the sugestion:
RANKED BY HIGHEST 2 MAXSPEED
WHERE TOTAL RNK.MAXSPEED EQ 2 ;

The report will return only Porsche car.


Eg:
RANK MAXSPEED CAR 01/11/15 02/11/2015 03/11/2015
1 200 FERRARI 200 180 98
2 190 PORSCHE 100 190 120
3 180 MUSTANG 180 110 120
...
x


WebFOCUS 8.0.06
Windows, All Outputs
 
Posts: 3 | Registered: September 24, 2014Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Add BY CAR if you want the second highest number for each car:

TABLE FILE CAR
 BY CAR
 RANKED BY HIGHEST 2 SALES
 WHERE TOTAL RNK.SALES EQ 2 ;
END

This assumes your 24 hours of data is vertical (one entry for each hour) instead of horizontal (each entry has 24 hour buckets).


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Second Max Value

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.