Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

duplicate values by using of left join

Hi Folks,

i have two table:

  

CategoryProductSales
C1p110
C1p150
C2p220
C2p312
C2p341
C3p215

  

CategoryProductCost
C1p15
C1p110
C2p220
C2p310
C2p312
C3p24

if i use the left join, than i have a duplicate values, i can solve it by using of concatenation, does anybody have any idea how to solve it by another way?

Thanks a lot

Beck

1 Solution

Accepted Solutions
PrashantSangle

Try Below script

Test:

LOAD Distinct

Category,

    Product,

    Sales

FROM

Book1.xlsx

(ooxml, embedded labels, table is Sheet2);

Left Join

LOAD Category,

    Product,

    Cost

FROM

Book1.xlsx

(ooxml, embedded labels, table is Sheet3);

Exit SCRIPT;

Also sample data attached.

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

12 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

It looks like you just concatenate. Is there any reason that you would want join these two? Joining usually implies adding fields from one table to another, but these two have the same fields.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
beck_bakytbek
Master
Master
Author

Hi Jonathan thanks a lot for your Feedback,

i solved that by using of concatenation, but then i thougth, what if, if i have more table like Sales and Costs

jonathandienst
Partner - Champion III
Partner - Champion III

Well it depends on what they look like and what you need to do with them.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
beck_bakytbek
Master
Master
Author

my idea was: if i have for example: more than 5 Table with 2 common field, then to concatename them, to create the fact table, and my question is: is that possible in this case only by using of concatentaion?

PrashantSangle

what is your expected output in this case???

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
MK9885
Master II
Master II

Yes you can concatenate your tables..

In one of my dashboards I concatenated 5 tables which had common fields but you'd need to create missing dimensions

Ex:

Table1

Load

A,

B,

C

0 as D

From ABC;

Concatenate

Table2:

Load

A,

B,

C,

D

From ABCD;

Concatenate

Table3:

A,

0 as B,

0 as C,

D

From AD;

and so on...

I did something just like this and got correct counts etc.

beck_bakytbek
Master
Master
Author

Hi Shahbaz

thanks a lot for your feedback

beck_bakytbek
Master
Master
Author

Hi Prashant

my Output was: is that possible to join the tables with common fields via left join and avoiding the duplicates

PrashantSangle

Yes you can join table with common fields avoiding duplicate.

But in as per your sample data there is no duplicate Because even if your category and product was same but there sales was different. Same for cost table

Use distinct keyword if whole line is duplicate.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂