Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculation between fields in different tables

I wan to do a calculation in the load with two fields that were brought in through different tables.

Example:

Mort_dt - Min(Place_Date)/7 as MortWeek

Mort_dt was brought in by a table named tblGAGroupMort

Place_Date was brought in by a table named tblGAGroupPlac

Any help you can offer will be greatly appreciated.

2 Replies
sudeepkm
Specialist III
Specialist III

if you just need the Min(Place_Date) from tblGAGroupPlac. then you can use like below.

tab1:

load * from tblGAGroupPlac;

tmp:

load Min(Place_Date) as mindt resident tab1;

let vMinDate = peek('mindt',0,'tmp');

drop table tmp;

tab2:

load *, (Mort_dt - '$(vMinDate)')/7 as MortWeek from tblGAGroupMort

veeranj
Creator II
Creator II

HI,

Join the two tables and then use the resident load and apply the condition on the two columns  in the resident load table.

For ex:

tab1:

load a,b,c

from tab1;

join

load c,d,e from tab2;

now

load if(a>d,'above','below') as compare,a,b,c,d resident tab1;

Thanks,

Anjee