# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Contributor

## 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:

Cheers...

Fab

1 Solution

Accepted Solutions
MVP

## Re: Adding QTY's from 2 tables

You need another table or final table please elaborate

Table1:

[

Product,WH,QTY

A,X,10

B,X,20

C,X,15

];

NoConcatenate

Table2:

[

Product,WH,QTY

A,y,20

B,y,40

C,y,30

];

ResultTab:

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table1

Group By Product;

Concatenate(ResultTab)

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:-

7 Replies
MVP

## Re: Adding QTY's from 2 tables

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

Dimension is Product

Sum(QTY)

Or

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

Honored Contributor III

## Re: Adding QTY's from 2 tables

Concatenate two tables...

Honored Contributor III

## Re: Adding QTY's from 2 tables

Like this you want

MVP

## Re: Adding QTY's from 2 tables

You need another table or final table please elaborate

Table1:

[

Product,WH,QTY

A,X,10

B,X,20

C,X,15

];

NoConcatenate

Table2:

[

Product,WH,QTY

A,y,20

B,y,40

C,y,30

];

ResultTab:

Product as Prod,

Sum(QTY) as TotalQTY

Resident Table1

Group By Product;

Concatenate(ResultTab)

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:-

Contributor

## Re: Adding QTY's from 2 tables

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!!

MVP

## Re: Adding QTY's from 2 tables

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

Drop tables Table1,Table2;

Contributor

## Re: Adding QTY's from 2 tables

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:

Product, WH, QTY

A, X, 10

B, X, 20

C, X, 15

];

TABLE2:

Product, WH, QTY

A, y, 10

B, y, 20

C, y, 15

];

Result: