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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jerryr125
Creator III
Creator III

Combining two tables with multiplying

Hi - 

Not sure if this can be done or not. I have two tables which needed to be loaded (table A and table B). Once loaded, table C  needs to be created that multiples the value of QTY and QTYMT to create field FQ.

See example below :

Table A

IDQTY
13
26
38
45

 

TABLE B

IDLIDQTYMT
15002
25004
27003
28005
35006
34008
420010

 

TABLE C

IDQTYLIDQTYMTFQ
1350026
26500424
26700318
26800530
38500648
38400864
4520010

50

 

Any thoughts ? Jerry

Labels (1)
3 Replies
Saravanan_Desingh
MVP
MVP

One Solution:

tab1:
LOAD * INLINE [
    ID, QTY
    1, 3
    2, 6
    3, 8
    4, 5
];

tab2:
LOAD * INLINE [
    ID, LID, QTYMT
    1, 500, 2
    2, 500, 4
    2, 700, 3
    2, 800, 5
    3, 500, 6
    3, 400, 8
    4, 200, 10
];

commQV84.PNG

Dimension:

ID, QTY, LID

Expression:

QTYMT

LQ: QTY*QTYMT

Vegar
MVP
MVP

If you need to make the 3rd table in script, then join 1 and 2  followed by a resident load on your new table sheet where you add the new fields by multiplication.

Take a look at my script suggestion below. 

[_TABLE C] :

Load * From [TABLE A] ;

JOIN ( [_TABLE C]) Load * From [TABLE B] ;

[TABLE C] :

NOCONCATENATE LOAD

*, [QTY] * [QTYMT] as [FQ] 

Resident [_TABLE C] ;

Drop table [_TABLE C] ;

jerryr125
Creator III
Creator III
Author

Hi  - Yes I just thought of doing some type of join after posting my questions.

I will give it a try and let you know - jerry