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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
shivram_l
Contributor
Contributor

Using variables in a load script

Hello. Posting below what I want to achieve:

 

daily_views:

load * from [daily_qvd];

 

let v_date = min(created_date); 

// created_date is a column in the daily_qvd

 

transaction_views:

load * from [txn_qvd]

where txn_date = $(v_date);

 

 

I'm trying to take the date variable from the daily_views table and use it to subset rows in the transaction views table. The variable created using the let statement gives me 0 records.

 

Appreciate the help.

 

 

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this

daily_views:
LOAD *
From [daily_qvd];

min_created_date:
LOAD Min(created_date) as min_created_date
Resident daily_views;

LET v_date = Peek('min_created_date'); 
TRADE $(v_date);
// created_date is a column in the daily_qvd

DROP Table min_created_date;

transaction_views:
LOAD * 
From [txn_qvd]
Where txn_date = $(v_date);

View solution in original post

1 Reply
sunny_talwar
MVP
MVP

Try this

daily_views:
LOAD *
From [daily_qvd];

min_created_date:
LOAD Min(created_date) as min_created_date
Resident daily_views;

LET v_date = Peek('min_created_date'); 
TRADE $(v_date);
// created_date is a column in the daily_qvd

DROP Table min_created_date;

transaction_views:
LOAD * 
From [txn_qvd]
Where txn_date = $(v_date);