Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add Column to Concatenated Table

Hello all,

I have 4 identical tables (split by years in the download) that are concatenated. They are basically Order Information with dates (order date, shipped date, invoiced date, etc).

What I want to do is, after loading and concatenating the 4 tables, do a couple of extra columns that calculate the time between dates as well as create a flag if the order shipped after it was supposed to.

I know that I can put these 5 or so calculations in each load statement but that doesn't seem to be the most efficienct. I tried doing something like:

Load *,

order date - shipped date as lag_time,

x - y  as z,

etc,

Resident Orders;

However, that doesn't seem to work well as it creates syn1 joins and an extra table. I thought about joining the resident table by using order numbers but that doesn't seem to work correctly as some orders have multiple lines.

Please point me in the right direction. Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

After creating the new table drop the old one:

NewOrders:

Load *,

order date - shipped date as lag_time,

x - y  as z,

etc,

Resident Orders;

drop table Orders;


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

After creating the new table drop the old one:

NewOrders:

Load *,

order date - shipped date as lag_time,

x - y  as z,

etc,

Resident Orders;

drop table Orders;


talk is cheap, supply exceeds demand
Not applicable
Author

try according to this syntax

load *, rowno() as key_table1;

load *, rowno() as key_table2;

load *, rowno() as key_table3;

load *, rowno() as key_table4;

then on the basis of this key you calculate the disired field.

Not applicable
Author

Never had to do that before, but it works perfectly. Thank you sir!