Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
Hello,
I want to retrieve the minimum and maximum date to store it in a variable, but the variable is empty each time.
can someone please help me
Temp:
LOAD
Min(Date) as MinDate,
Max(Date) as MaxDate
FROM [lib://QlikSense/MyFolder/MyQvd.qvd](qvd) ;
LET vMinDate = peek('MinDate');
LET vMaxDate = peek('MaxDate');
TRACE 'vMinDate'+$(vMinDate);
TRACE 'vMaxDate'+$(vMaxDate);
It looks like it should work as written. It may be that the Date field is a Text value, not a numeric date value. In that case you will have to convert the Date as you read with
Min(Date#(Date, 'DD/MM/YY'))
where DD/MM/YY is whatever your text date format is.
-Rob
Hi,
If you try with more parameter :
LET vMinDate = peek('MinDate', 0);
LET vMaxDate = peek('MaxDate', 0);
Aurélien
It looks like it should work as written. It may be that the Date field is a Text value, not a numeric date value. In that case you will have to convert the Date as you read with
Min(Date#(Date, 'DD/MM/YY'))
where DD/MM/YY is whatever your text date format is.
-Rob
Temp:
LOAD
Min(Date) as MinDate,
Max(Date) as MaxDate
FROM [lib://QlikSense/MyFolder/MyQvd.qvd](qvd) ;
LET vMinDate = peek('MinDate',0,Temp);
LET vMaxDate = peek('MaxDate',-1,Temp);
TRACE 'vMinDate'+$(vMinDate);
TRACE 'vMaxDate'+$(vMaxDate);
See the attched File as a sample , I am using Inline Table , You Can use pour Qvd.
Hi,
Please try the below code.
Temp:
LOAD
Min(Date) as MinDate,
Max(Date) as MaxDate
FROM [lib://QlikSense/MyFolder/MyQvd.qvd](qvd) ;
LET vMinDate = peek('MinDate',0,'Temp');
LET vMaxDate = peek('MaxDate',0,'Temp');
Trace $(vMinDate );
Trace $(vMaxDate );
Drop table Temp;
Assuming you've checked that MinDate and MaxDate fields return an appropriate value, using the Peek()-function outside a LOAD-statement requires that you use all 3 arguments: field_name, row_no and table_name.