Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Concatenate two different

Hi All

How do I merge Table 1 & 2 with same column heading (in load script or in straight table)

Table 1. (Table Name : Product)

OrderIdProductNameProductTypePrice
1CokeDrink2.50
2SandwichFood7.00
3WaterDrink3.50

Table 2.(Table Name : Charge)

OrderIdChargeNameCharge
1Service Fee2.00
1Reservation Fee5.00
2Service Fee2.00
3Service Fee2.00

I want to merge the Charge Name & Product Name as one called 'Cost Name' and Price and Charge as 'Cost'


So the final table should look like this.

OrderIdCost NameCost
1Coke23
1Service Fee2.00
1Reservation Fee5.00
2Sandwich7.00
2Service Fee2.00
3Water3.50
3Service Fee2.00
2 Replies
Not applicable
Author

To do it in the Script perform the following steps:

1. Load your first set of data, but name it as the final Cost Table.

2. Rename each column as if it is the final Cost Table.

3. When loading the next set of data do NOT give it a filename, but just load it which will append it to the Cost Table created above.

4. Make sure to name each column identical to those in step 2 above.

CostTable:
LOAD OrderId,
[Product Name] as CostName,
Price as Cost
FROM

(
ooxml, embedded labels, table is Sheet1);

LOAD OrderId,
[Charge Name] as CostName,
Charge as Cost
FROM

(
ooxml, embedded labels, table is Sheet2);

Sheet1 of Combine.xlsx:

Sheet2 of Combine.xlsx:

Is this what you need?

- Stan

trdandamudi
Master II
Master II

May be as below:

Concatenate.jpg