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: 
qlikviewwizard
Master II
Master II

custom column from two table columns

Hi All,

I have two tables as shown below.

TableA:

Load * inline [

EMPNO,A,B,SAL

EMPNO1,A1,B1,10

EMPNO2,A2,B2,20

EMPNO3,A3,B3,30

EMPNO4,A4,B4,40

EMPNO5,A5,B5,50

];

TableB:

Load * inline [

EMPNO,COMM,C

EMPNO1,10,C1

EMPNO2,20,C2

EMPNO3,30,C3

EMPNO4,40,C4

EMPNO5,50,C5

];

I want to derive new column percentage with COMM and SAL.

Required column: COMM/SAL.

How to achieve this?

Thanks in advance.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi,

Use mapping load in your script

Load * inline [
EMPNO,A,B,SAL
EMPNO1,A1,B1,10
EMPNO2,A2,B2,20
EMPNO3,A3,B3,30
EMPNO4,A4,B4,40
EMPNO5,A5,B5,50
]
;
Mapping_Table:
Mapping Load EMPNO,SAL Resident TableA;

TableB:
load *, COMM/ApplyMap('Mapping_Table',EMPNO) as Percentage;
Load * inline [
EMPNO,COMM,C
EMPNO1,10,C1
EMPNO2,20,C2
EMPNO3,30,C3
EMPNO4,40,C4
EMPNO5,50,C5
]
;

Regards,

Greeshma

View solution in original post

6 Replies
mrossoit
Creator II
Creator II

TableA:

Load * inline [

EMPNO,A,B,SAL

EMPNO1,A1,B1,10

EMPNO2,A2,B2,20

EMPNO3,A3,B3,30

EMPNO4,A4,B4,40

EMPNO5,A5,B5,50

];

join

Load * inline [

EMPNO,COMM,C

EMPNO1,10,C1

EMPNO2,20,C2

EMPNO3,30,C3

EMPNO4,40,C4

EMPNO5,50,C5

];

TableAB:

load *, COMM/SAL as percentage

resident TableA;


drop table TableA;


Regards

MR

Anonymous
Not applicable

Hi,

Use mapping load in your script

Load * inline [
EMPNO,A,B,SAL
EMPNO1,A1,B1,10
EMPNO2,A2,B2,20
EMPNO3,A3,B3,30
EMPNO4,A4,B4,40
EMPNO5,A5,B5,50
]
;
Mapping_Table:
Mapping Load EMPNO,SAL Resident TableA;

TableB:
load *, COMM/ApplyMap('Mapping_Table',EMPNO) as Percentage;
Load * inline [
EMPNO,COMM,C
EMPNO1,10,C1
EMPNO2,20,C2
EMPNO3,30,C3
EMPNO4,40,C4
EMPNO5,50,C5
]
;

Regards,

Greeshma

petter
Partner - Champion III
Partner - Champion III

I would do the calculation in the UI and do:

TABLE:

Load * inline [

EMPNO,A,B,SAL

EMPNO1,A1,B1,10

EMPNO2,A2,B2,20

EMPNO3,A3,B3,30

EMPNO4,A4,B4,40

EMPNO5,A5,B5,50

];

JOIN

Load * inline [

EMPNO,COMM,C

EMPNO1,10,C1

EMPNO2,20,C2

EMPNO3,30,C3

EMPNO4,40,C4

EMPNO5,50,C5

];

qlikviewwizard
Master II
Master II
Author

petter-s

How would you do? Please help to provide code.

petter
Partner - Champion III
Partner - Champion III

The JOIN has been done as I indicated in the Load Script I posted.

The calculation in a chart would simply be:

COMM/SAL as an expression where you need it to be calculated ....

qlikviewwizard
Master II
Master II
Author

Thank you All.