Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
shovongoutam
Contributor II
Contributor II

Multiplication fields from different tables ApplyMap

Hell All,

I am new to Qlik.

I have two tables similar to the following

Capture.PNG

I want a new field on Table1, NewField = DP (Table1)* DEM(Table2)

How can I achieve that

Labels (4)
2 Solutions

Accepted Solutions
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hey,

 

Here is the general concept for how to achieve this:
1) Join tables

2) Resident load and multiply the two fields

 

Working script:

TestData:
Load * INLINE [
SEG, Year, DP
XY,2020,0.1
XY,2021,1.1
XY,2022,2.1
AA,2020,3.1
AA,2021,4.1
AA,2022,5.1
TT,2020,6.1
TT,2021,7.1
TT,2022,8.1
];

LEFT JOIN(TestData)
Load * INLINE [
SEG, Year, DEM
XY,2020,0.1
XY,2021,1.1
XY,2022,2.1
AA,2020,3.1
AA,2021,4.1
AA,2022,5.1
TT,2020,6.1
TT,2021,7.1
TT,2022,8.1
];

Table1:
NoConcatenate
LOAD
	SEG
, Year
, DP
, DEM
, DP*DEM as NewField
RESIDENT TestData
;

View solution in original post

Brett_Bleess
Former Employee
Former Employee

Did Stoyan's post get you what you needed?  If so, do not forget to return to the thread and use the Accept as Solution button on his post to mark things and give him credit for the assistance as well as let other Community Members know things worked.  If you are still needing help, please leave a new update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.

View solution in original post

3 Replies
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hey,

 

Here is the general concept for how to achieve this:
1) Join tables

2) Resident load and multiply the two fields

 

Working script:

TestData:
Load * INLINE [
SEG, Year, DP
XY,2020,0.1
XY,2021,1.1
XY,2022,2.1
AA,2020,3.1
AA,2021,4.1
AA,2022,5.1
TT,2020,6.1
TT,2021,7.1
TT,2022,8.1
];

LEFT JOIN(TestData)
Load * INLINE [
SEG, Year, DEM
XY,2020,0.1
XY,2021,1.1
XY,2022,2.1
AA,2020,3.1
AA,2021,4.1
AA,2022,5.1
TT,2020,6.1
TT,2021,7.1
TT,2022,8.1
];

Table1:
NoConcatenate
LOAD
	SEG
, Year
, DP
, DEM
, DP*DEM as NewField
RESIDENT TestData
;
Brett_Bleess
Former Employee
Former Employee

Did Stoyan's post get you what you needed?  If so, do not forget to return to the thread and use the Accept as Solution button on his post to mark things and give him credit for the assistance as well as let other Community Members know things worked.  If you are still needing help, please leave a new update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Dhirendra_Kharwar_13373

//Mapping table
Table1:
Mapping
Load
SEG,
DP
From Table1;

//Mapped here
Table2:
Load
ApplyMap('Table1',SEG,Null()) as DP,
SEG,
Year,
DEM
From Table2;

//Resident Table calculate here
Table3:
Load
SEG,
Year,
DEM*DP as Multiplication
Resident Table2;
Drop Table Table2;