Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
schmidtj
Creator II
Creator II

Remove duplicates in reverse order

Hi,

i have a questions.
I have a table with reverse duplicates, see this example data:

ID # FOREIGN ID
1 # 2
1 # 5
1 # 9
9 # 1
5 # 1
2 # 1

I just need the corrrelation, the direction doesnt matter.
Meaning i need to get rid of the first 3 or the last 3 lines.

Can anybody help me with that? I dont manage to get that done 😕

Cheers.

1 Solution

Accepted Solutions
Taoufiq_Zarra

Hi,

try this:

Input:


LOAD F1&'_'&F2 as Key,* INLINE [
    F1, F2
    1, 2
    1, 5
    1, 9
    9, 1
    5, 1
    2, 1
];


NoConcatenate
Result:
load * ,
F2&'_'&F1 as key1 
resident Input

Where not Exists(key1,Key);

dROP Table Input;
Drop field key1,Key;

 

outuput:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

Hi,

try this:

Input:


LOAD F1&'_'&F2 as Key,* INLINE [
    F1, F2
    1, 2
    1, 5
    1, 9
    9, 1
    5, 1
    2, 1
];


NoConcatenate
Result:
load * ,
F2&'_'&F1 as key1 
resident Input

Where not Exists(key1,Key);

dROP Table Input;
Drop field key1,Key;

 

outuput:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
schmidtj
Creator II
Creator II
Author

Thanks a lot, that works for me!