Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding QTY's from 2 tables

Hello good Qlik Community people...

I have 2 warehouses with product QTY's, I need to add the two QTY's into a master table.

What's the simplest way I can achieve this?

Here's a simplified representation of what I'm trying to achieve:

WH Tables.JPG

Thanks in advance!!

Cheers...

Fab

1 Solution

Accepted Solutions
its_anandrjs

You need another table or final table please elaborate

Table1:

LOAD * Inline

[

Product,WH,QTY

A,X,10

B,X,20

C,X,15

];

NoConcatenate

Table2:

LOAD * Inline

[

Product,WH,QTY

A,y,20

B,y,40

C,y,30

];

ResultTab:

LOAD

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table1

Group By Product;

Concatenate(ResultTab)

LOAD

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table2

Group By Product;

NoConcatenate

FinalResult:

LOAD Prod,Sum(TotalQTY) as TotalQTY Resident ResultTab Group By Prod;

DROP Table ResultTab;

OutPut:-

OP4.PNG

View solution in original post

7 Replies
Anil_Babu_Samineni

You dont' need anything here.. Consider as expression like below

Dimension is Product

Sum(QTY)

Or

Sum({<WH = {"x","y"}>} QTY)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prma7799
Master III
Master III

Concatenate two tables...

prma7799
Master III
Master III

Like this you want

its_anandrjs

You need another table or final table please elaborate

Table1:

LOAD * Inline

[

Product,WH,QTY

A,X,10

B,X,20

C,X,15

];

NoConcatenate

Table2:

LOAD * Inline

[

Product,WH,QTY

A,y,20

B,y,40

C,y,30

];

ResultTab:

LOAD

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table1

Group By Product;

Concatenate(ResultTab)

LOAD

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table2

Group By Product;

NoConcatenate

FinalResult:

LOAD Prod,Sum(TotalQTY) as TotalQTY Resident ResultTab Group By Prod;

DROP Table ResultTab;

OutPut:-

OP4.PNG

Anonymous
Not applicable
Author

Thanks everyone for your suggestions...

I will see how I can use these concepts on my tables and mark as helpful / correct as applicable...

the example is a bit over-simplified, but the principle is the same...

I have never used concatenate before so it would be good to learn this function...

Thanks again and you will hear from me soon!!

its_anandrjs

Find the attached if tables Table1 and Table2 not required then you can use to drop them by


Drop tables Table1,Table2;

imrasyed
Partner - Creator II
Partner - Creator II

Hi,

I am a new to Qlik but tried the above requirement.Please let me know if this is what you are looking for.

TABLE1:

LOAD * INLINE [

    Product, WH, QTY

    A, X, 10

    B, X, 20

    C, X, 15

];

TABLE2:

LOAD * INLINE [

    Product, WH, QTY

    A, y, 10

    B, y, 20

    C, y, 15

];

Result:

Load Product,sum(QTY)

Resident  TABLE1

group by Product;