Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 r_vdbraak
		
			r_vdbraak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Who can help me solving this problem.
I'm using a script to select the value of the lowest Koers and the highest Koers
It works correct as long there are no double Koers values
If there is a double Value I want to select the latest date.
DateMaxKoers
LOAD
FirstSortedValue(Date, -Koers) AS DateMaxKoers
Resident Koersen;
LOAD
FirstSortedValue(Date, Koers) AS DateMinKoers
Resident Koersen;
I expect as DateMaxKoers 16-04-2014 11,95
as DateMinKoers 14-04-2014 11,75
| Date | Koers | 
| 17-04-2014 | 11,91 | 
| 16-04-2014 | 11,95 | 
| 15-04-2014 | 11,84 | 
| 14-04-2014 | 11,75 | 
| 11-04-2014 | 11,83 | 
| 10-04-2014 | 11,76 | 
| 09-04-2014 | 11,77 | 
| 08-04-2014 | 11,75 | 
| 07-04-2014 | 11,94 | 
Thanks for thinking with me.
 r_vdbraak
		
			r_vdbraak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Treseco,
When I use Order by Date desc I got what I expect.
Thanks for your help.
Gr. Richard
The complete script:
LOAD
FirstSortedValue(Date, Koers) AS DateMinKoers
Resident Koersen
Order by Date desc;
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try using distinct like:
LOAD
FirstSortedValue( Distinct Date, Koers) AS DateMinKoers
Don't worry about syntax error red mark.
 r_vdbraak
		
			r_vdbraak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Treseco,
Thanks for your helpful thinking.
Using Distinct gives me a value, but it is the first date (08-04-2014) in stead of the last date (14-04-2014)
Gr. Richard
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		User the Order By clause to change the order of load , like:
Temp:
Load * Inline [
Date,     Koers
17-04-2014, 11.91
16-04-2014, 11.95
15-04-2014, 11.84
14-04-2014, 11.75
11-04-2014, 11.83
10-04-2014, 11.76
09-04-2014, 11.77
08-04-2014, 11.75
07-04-2014, 11.94
];
Fin:
Load
 FirstSortedValue(distinct Date, Koers) as FSV
Resident Temp order by Date asc;
 r_vdbraak
		
			r_vdbraak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Treseco,
When I use Order by Date desc I got what I expect.
Thanks for your help.
Gr. Richard
The complete script:
LOAD
FirstSortedValue(Date, Koers) AS DateMinKoers
Resident Koersen
Order by Date desc;
 
					
				
		
Example for you with calculations in the script and on the fly.
Regards
Darek
