Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mapping in order to replace multiple rows

Hi I have the attached sample data. Effectively a main table with the associated lookup on the second tab to replace department and business unit matching on sales_id. As compared to a left join I want to keep the original department and business unit values from the main table. Is there an easy way to do this rather than write 3 separate mapping loads ?

1 Solution

Accepted Solutions
sunny_talwar

May be something like this?

MappingTable:

Mapping

LOAD Sales_ID,

    Department&'|'&[Business Unit]

FROM

[SAMPLE (1).xlsx]

(ooxml, embedded labels, table is Lookup);

Sales:

LOAD Sales_ID,

    Sales_amount,

    Sales_Person,

    Department,

    [Business Unit],

    SubField(ApplyMap('MappingTable', Sales_ID, Department&'|'), '|', 1) as [New Department],

    SubField(ApplyMap('MappingTable', Sales_ID, '|'&[Business Unit]), '|', 2) as [New Business Unit]

FROM

[SAMPLE (1).xlsx]

(ooxml, embedded labels, table is Sales);

View solution in original post

3 Replies
sunny_talwar

May be something like this?

MappingTable:

Mapping

LOAD Sales_ID,

    Department&'|'&[Business Unit]

FROM

[SAMPLE (1).xlsx]

(ooxml, embedded labels, table is Lookup);

Sales:

LOAD Sales_ID,

    Sales_amount,

    Sales_Person,

    Department,

    [Business Unit],

    SubField(ApplyMap('MappingTable', Sales_ID, Department&'|'), '|', 1) as [New Department],

    SubField(ApplyMap('MappingTable', Sales_ID, '|'&[Business Unit]), '|', 2) as [New Business Unit]

FROM

[SAMPLE (1).xlsx]

(ooxml, embedded labels, table is Sales);

el_aprendiz111
Specialist
Specialist

HI

[TABLE]:

LOAD * Inline

[

Sales_ID, Sales_amount, Sales_Person, Department, Business Unit

100, 1000, Adam, HR, North

101, 2000, Michael, FINANCE, South

102, 5000, Page, IT, East

103, 3000, Jim, COMMERCIAL, West

104, 2000, Sarah, FACILITIES, East

];

Left Join(TABLE)

LOAD * Inline

[

Sales_ID, Business Unit 2

101, INTERNATIONAL

102, NATIONAL

103, STATE

];

Not applicable
Author

Thanks Sunny. Great solution.