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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
llky23
Contributor
Contributor

Multiply 2 table with multiple conditions

Hi, I have 2 tables and I want to multiply them together as follows:

Table 1:

CCMonthYearGLTextAmt
8000100120208000101a110

 

Table 2:

CCPrd CCMonthYearRatio
80001001999991202050%
80001002989991202050%

 

I want to end result to be this table

Result_table:

CCMonthYearGLTextAmtPrd CCFinal AmtRatio
8000100120208000101a110199999550%
8000100120208000101a110298999550%

 

The matching conditions between Table 1 and 2 are [CC] , [Month] , [Year]

How can I do this in script, thanks!!

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

HI 

check this script 

Table1:
load * inline [
CC,	Month,	Year,	GL,	Text	,Amt
8000100,	1,	2020,	8000101,	a1,	10
];
left join (Table1)
load * inline [
CC,	PrdCC,	Month,	Year,	Ratio
8000100,	199999,	1,	2020,	0.5
8000100,	298999,	1,	2020,	0.5
];

FinalTable:
load *,
     Amt*Ratio as FinalAmt
resident Table1;

drop Table Table1;

View solution in original post

1 Reply
lironbaram
Partner - Master III
Partner - Master III

HI 

check this script 

Table1:
load * inline [
CC,	Month,	Year,	GL,	Text	,Amt
8000100,	1,	2020,	8000101,	a1,	10
];
left join (Table1)
load * inline [
CC,	PrdCC,	Month,	Year,	Ratio
8000100,	199999,	1,	2020,	0.5
8000100,	298999,	1,	2020,	0.5
];

FinalTable:
load *,
     Amt*Ratio as FinalAmt
resident Table1;

drop Table Table1;