Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ilanbaruch
Specialist
Specialist

peek min & max functions

hi, i use min & max function to find min & max date values before calendar build

than put it into a variable with peek

recently read here : http://www.learnqlickview.com/qlikview-tutorial-a-how-to-tip-on-data-load/

that its more effective to sort the date than peek .. it works for the min but not for the max

tried it like this:


LOAD

DATE

Resident ACCOUNTS Order By DATE desc;

LET varMinDate = Num(Peek('DATE ', 0, 'minmaxdate'));

LET varMaxDate = Num(Peek('DATE ',-1, 'minmaxdate'));

any ideas?

4 Replies
sunny_talwar

A even better way to do this would be to use FieldValue function. Check out here: “Fastest” Method to Read max(field) From a QVD | Qlikview Cookbook

florentina_doga
Partner - Creator III
Partner - Creator III

try this

aa:

LOAD

DATE

Resident ACCOUNTS Order By DATE desc;

noconcatenate

bb:

load max(DATE ) as max_data,

min(DATE ) as min_data

resident aa;

LET varMinDate = Num(Peek('min_data', 0, 'bb'));

LET varMaxDate = Num(Peek('max_data ',0, 'bb'));

drop table aa;

ilanbaruch
Specialist
Specialist
Author

thank you, but i'm trying to avoid min & max function

ilanbaruch
Specialist
Specialist
Author

solved with SQL statement directly from the table min & max works good, faster then resident ..

-------

OLEDB CONNECT TO ...

minmaxdate:

SQL

select

max(date) as maxdate,

min(date) as mindate

from orders;