Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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

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'));