Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
RafaelPerez
Contributor II
Contributor II

Joining 2 Tables to an existing Table

I have 3 tables that I want to merge into one:

- Initial Stock: ItemID / Shop / Stock
- Movements: ItemID / Shop / Date / Received / Sent
- Sales             : ItemID / Shop / Date / Sales

Both Movements and Sales only matter when there's initial stock, so I want to left join them both into Initial Stock. But when I use the second left join (loading Sales) it uses Movement's Date as a parameter too, and leaves out the sales that were made in days with no movements. 

If I could join Sales without taking Date into account it would work out.
Is there a way to achieve this?
Thanks in advance.

Labels (1)
1 Reply
marcus_sommer

I think I wouldn't join these tables else just concatenate them, maybe with something like this:

table:
load 'Initial' as Source, ItemID, Shop, '2019/01/01' as Date, Stock as Amount from A;
load 'Movements' as Source, ItemID, Shop, Date, rangesum(Received, -Sent) as Amount from B;
load 'Sales' as Source, ItemID, Shop, Date,  -Sales as Amount from C;

whereby it's not mandatory to synchronize the different amount-fields - an unsynchronized table would also work - but with it it will be easier within the UI.

- Marcus