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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Define variables outside of Load statement

Dear All,

i'm looking for a way to define a variable in the script editor, outside of the load statement. To give some context info: in my current qv report, i load sales data from three different excel files;

for the field 'Date', i would like to define a variable called 'maxdate', calculating the most recent date of all my data, to immediately show the last day's numbers on my dashboard screen.

how would you do this?

thank you,

joris

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

Create the variable in Variable Overview

Define the variable as:

=max(YourDateField)

View solution in original post

4 Replies
sushil353
Master II
Master II

use max(datefield)

rajni_batra
Specialist
Specialist

Load Only date field from all ur excels and concate them, then take resident of that and calculate max(date) as Date and then use peek function to store that into a variable.

Transactions:
LOAD
     [Date] as [Posting Date] 
FROM

(qvd);

concatenate

LOAD
     DATE as [Posting Date]    
FROM

(qvd);

Temp:
Load
               min([Posting Date]) as minDate,
               max([Posting Date]) as maxDate
Resident Transactions;

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));

m_woolf
Master II
Master II

Create the variable in Variable Overview

Define the variable as:

=max(YourDateField)

Not applicable
Author

Thank you,

it works