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

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

How to do a calculation in the script between 2 fields from 2 diff tables?

Hello all.

I have 2 tables:

Table T1:
Columns: A, B and C

Table T2:
Columns A, D and E

The link between T1 and T2 is made by column A.

I need in the script to join both tables in one single logic table and also calculate the result of C * E.

Join the tables is easy, I am doing this:

myTable:
Load A, B, C From T1;
INNER JOIN Load A, D, E From T2;

However, how to calculate C * E?

If I try this:


myTable:
Load *, C * E;
Load A, B, C From T1;
INNER JOIN Load A, D, E From T2;

It says column E is unknown because the preceding load does not read T2. So, how can I do what I need to do?

11 Replies
Not applicable
Author

I am adding a new column in the load resident, so I don't know why is concatenating.

Not applicable
Author

Hi Igor,

Why dont you do this

Table:

LOAD A, B, C FROM T1

Concatenate (Table)

LOAD A, D, E FROM T2

Then in the Interface use the expression SUM(B) - SUM(D)

Alternatively if the calculations have to be done in the script do the concatenate in the script as a temporary table, then doing a resident load from that and use a group by function will manipulate the data accordingly.

Then add a preceding load taking one field away from the other field.

Hope this is of help,

Regards,

Neil