Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

matching existing data with new data

Hello  community,

I have an Excel Data with two sheets (Sheet1 = Customer1, Sheet2=Customer2) which has completele the same structure but with some different datas.

Example:

First Sheet

Customer 1

CustomernameProductCost
Customer1A10 €
Customer1B20 €
Customer1C30 €
Customer1D40 €

Second Sheet

Customer 2

CustomernameProductCost
Customer2AUnknown
Customer2B20 €
Customer2C30 €
Customer2DUnknown
Custmoer2E50 €
Customer2F60 €

As you can see the products are the same but some costs are still unknown for product A and D from Customer 2 although the cost are the same as like customer 1.

What I like to do is, that qv should adapt the existing costs if the name of the product is the same. Something like this

If  Product A = Product A from existing Data, then give out Cost of Product A = 10 €

so the new table should be like this:

CustomernameProductCost
Customer2A10 €
Customer2B20 €
Customer2C30 €
Customer2D40 €

and with the adapting result i would like to calculate afterwards. something like

If  Product A = Product A from existing Data, then give out Cost of Product A = 10 € ---> Avg(Cost) from customer2

is this prossible in QV?

2 Replies
stigchel
Partner - Master
Partner - Master

Yes it is possible, you can use the lookup function, something like

Data:

LOAD Customername,

    Product,

    Cost

FROM

[https://community.qlik.com/thread/172072]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate

LOAD Customername,

    Product,

    if(Cost='Unknown',Lookup('Cost','Product',Product,'Data'),Cost) as Cost

FROM

[https://community.qlik.com/thread/172072]

(html, codepage is 1252, embedded labels, table is @2);

//lookup('Price', 'ProductID', InvoicedProd, 'pricelist')

Lookup.png

See also attached

maxgro
MVP
MVP

FirstSheet:

LOAD Customername,

     Product,

     Cost

FROM

[https://community.qlik.com/thread/172072]

(html, codepage is 1252, embedded labels, table is @1);

PriceMap:

Mapping LOAD Product, Cost

Resident FirstSheet;

Concatenate (FirstSheet)

LOAD Customername,

     Product,

     if(Cost ='Unknown', ApplyMap('PriceMap', Product), Cost) as Cost

FROM

[https://community.qlik.com/thread/172072]

(html, codepage is 1252, embedded labels, table is @2);


1.png