Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Tatalay2021
Contributor II
Contributor II

Retail Duplicate Records Data Load

Hello,

I have a use case to load two sets of files where the the data in the first file (Table 1) contains duplicate ID rows and only one instance of the same ID in the second file (Table 2). I would like the data from Table 2 to be repeated for each instance of row in Table 1. I am attaching the below image to help illustrate the two tables and the expected result. 

I have tried multiple types of Joins but can't see to get the desired outcome and would appreciate if anyone could suggest possible solutions to consider.

Thanks,

 

TableLoad - Copy.PNG

 

1 Solution

Accepted Solutions
Nicole-Smith

Script like this with a left join should work:

Table1:
LOAD ID, Value AS [Table 1 Value]
INLINE [
	ID, Value
    1, 100
    1, 150
    2, 250
    2, 75
    3, 58
    3, 36
];

LEFT JOIN (Table1)
//Table2:
LOAD ID, Value AS [Table 2 Value]
INLINE [
	ID, Value
    1, 100
    2, 75
    3, 58
];

 

It returns an output table that looks like this: 

Nicole-Smith_0-1607983980433.png

 

View solution in original post

4 Replies
Nicole-Smith

Script like this with a left join should work:

Table1:
LOAD ID, Value AS [Table 1 Value]
INLINE [
	ID, Value
    1, 100
    1, 150
    2, 250
    2, 75
    3, 58
    3, 36
];

LEFT JOIN (Table1)
//Table2:
LOAD ID, Value AS [Table 2 Value]
INLINE [
	ID, Value
    1, 100
    2, 75
    3, 58
];

 

It returns an output table that looks like this: 

Nicole-Smith_0-1607983980433.png

 

Tatalay2021
Contributor II
Contributor II
Author

Thanks for your feedback, Nicole! 

I did try LEFT JOIN but unfortunately my straight table is not behaving as I expect it to. I am not certain if it the load issue or how my table is setup. At the moment, it just appears to return the data from one of the tables. I added a dimension to pull from the second table but does not return any data.

I understand I may not be describing the issue thoroughly here but please let me know if there is something I can add to clarify it better.

Thanks again,

Nicole-Smith

You'll need to add an example QVW file for further help.  It's hard to understand what isn't working if you've followed the same steps I have above.

Tatalay2021
Contributor II
Contributor II
Author

Looks like my issues was due to my expressions. The left join you recommended works as expected.

Thank you so much!