Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
r_vdbraak
Contributor III
Contributor III

FirstSortedValue

Dear Qlikview Friends,

I want to select the last date with the highest Koers.

I use this code:

tmpDir:

LOAD

  FirstSortedValue(Datum, -Koers) AS DatumHoogsteKoers

Resident Koersen

Order By Datum asc;

This code works fine except when there are more dates with the same highest Koers

Who can help me.

1 Solution

Accepted Solutions
r_vdbraak
Contributor III
Contributor III
Author

Gysbert,

With your suggestion I created this solution.

//Hoogste koers

tmpKoers:

LOADMax(Koers) AS KoersMax

Resident Koersen;


//Datum hoogste koers

tmpDatum:LOADMax(Datum) AS DatumHoogsteKoers

Resident Koersen

Where Koers = NUM(PEEK('KoersMax' , 0, 'tmpKoers'));

LET vDatumHoogsteKoers = NUM(PEEK('DatumHoogsteKoers' , 0, 'tmpDatum'));

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

tmpKoersen:

Load Datum, Koers

From ...

join (tmpKoersen)

Load Datum, max(Koers) as Koers, 1 as Flag

Resident tmpKoersen;

Result:

Load max(Datum) as DatumHoogsteKoers

Resident tmpKoersen

Where Flag =1;


talk is cheap, supply exceeds demand
r_vdbraak
Contributor III
Contributor III
Author

Gysbert,

Thanks for your reaction.

I will try to fix it with your solution.

r_vdbraak
Contributor III
Contributor III
Author

Gysbert,

With your suggestion I created this solution.

//Hoogste koers

tmpKoers:

LOADMax(Koers) AS KoersMax

Resident Koersen;


//Datum hoogste koers

tmpDatum:LOADMax(Datum) AS DatumHoogsteKoers

Resident Koersen

Where Koers = NUM(PEEK('KoersMax' , 0, 'tmpKoers'));

LET vDatumHoogsteKoers = NUM(PEEK('DatumHoogsteKoers' , 0, 'tmpDatum'));