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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
mnvrma
Partner - Contributor III
Partner - Contributor III

Variable

T1:

LOAD * INLINE [

CDate

01/31/2015

02/29/2015

03/31/2015

];

I want to get the Variable of Max of Date from 'Table T1' and want to use that variable in the 'Where Condition' in 'Table T2'. So that I can get a Date that is greater than the variable date in 'Table T2'.

T2:

LOAD * INLINE [

CDate

01/31/2015

02/29/2015

03/31/2015

04/30/2015

05/31/2015

01/31/2015

];

1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

@mnvrma 

You are going to need a NoConcatenate statement before your T2 load to have a separate table.  If you load a table with the same columns as another table, Qlik will automatically concatenate the two tables into one.

The following load scripts set a variable, vMaxCDate with the max CDate value of T1 and loads a table T2 with only CDates greater than that variable.  Since the 2 tables will be associated because they both contain CDate, you may wanted to rename CDate in T2 to view the difference.  I am assuming there are other process you will completing in the load script.

T1:
LOAD * INLINE [
CDate
01/31/2015
02/29/2015
03/31/2015
];

temp_maxCDate:
LOAD max(CDate) as maxCDate
resident T1;

let vMaxCDate = Peek('maxCDate',0,'temp_maxCDate');

DROP TABLE temp_maxCDate;


NoConcatenate
T2_Temp:
LOAD * INLINE [
CDate
01/31/2015
02/29/2015
03/31/2015
04/30/2015
05/31/2015
01/31/2015
];

NoConcatenate
T2:
Load CDate
Resident T2_Temp
where CDate > '$(vMaxCDate)';

Drop table T2_Temp;

View solution in original post

1 Reply
GaryGiles
Specialist
Specialist

@mnvrma 

You are going to need a NoConcatenate statement before your T2 load to have a separate table.  If you load a table with the same columns as another table, Qlik will automatically concatenate the two tables into one.

The following load scripts set a variable, vMaxCDate with the max CDate value of T1 and loads a table T2 with only CDates greater than that variable.  Since the 2 tables will be associated because they both contain CDate, you may wanted to rename CDate in T2 to view the difference.  I am assuming there are other process you will completing in the load script.

T1:
LOAD * INLINE [
CDate
01/31/2015
02/29/2015
03/31/2015
];

temp_maxCDate:
LOAD max(CDate) as maxCDate
resident T1;

let vMaxCDate = Peek('maxCDate',0,'temp_maxCDate');

DROP TABLE temp_maxCDate;


NoConcatenate
T2_Temp:
LOAD * INLINE [
CDate
01/31/2015
02/29/2015
03/31/2015
04/30/2015
05/31/2015
01/31/2015
];

NoConcatenate
T2:
Load CDate
Resident T2_Temp
where CDate > '$(vMaxCDate)';

Drop table T2_Temp;