Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
suraj_qlik
Contributor II
Contributor II

Removing duplicates

Hello Guys,

Can you help to remove the duplicates from a chart which would look something like this:(sample data)

KPI_1KPI_2Correlation
AB.5
BA.5
AD.6
CD.5
DA0.6

 It should look like the following:

KPI_1KPI_2Correlation
AB.5
AD.6
CD.5

so since correlation of A and B is same as B & A, hence I want those to removed.

Please help.

 

 

Labels (1)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

tmp:
LOAD  In, RecId, Concat(Char) as Out,KPI_1,	KPI_2,	Correlation
GROUP BY In, RecId,KPI_1,	KPI_2,	Correlation;
LOAD *, Recno() as RecId,
  Mid(In,Iterno(),1) as Char
WHILE iterno() <= Len(In);
Load *, KPI_1&KPI_2&Correlation as In;
Load * Inline [
KPI_1,	KPI_2,	Correlation
A,	B,	0.5
B,	A,	0.5
A,	D,	0.6
C,	D,	0.5
D,	A,	0.6
];

NoConcatenate
final:
load *, if(Out=peek(Out,-1),Null(),Out) as test Resident tmp 
Where if(Out=peek(Out,-1),Null(),Out)<>Null() Order by Out; DROP Table tmp;

View solution in original post

3 Replies
Anil_Babu_Samineni

Does it mean, If KPI1 or KPI2 having similar values it should not point to duplicate value or Correlation?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
suraj_qlik
Contributor II
Contributor II
Author

Yes, correct @Anil_Babu_Samineni . We should be able to see just correlation of A & B and not B & A (as it will be same)

Frank_Hartmann
Master II
Master II

tmp:
LOAD  In, RecId, Concat(Char) as Out,KPI_1,	KPI_2,	Correlation
GROUP BY In, RecId,KPI_1,	KPI_2,	Correlation;
LOAD *, Recno() as RecId,
  Mid(In,Iterno(),1) as Char
WHILE iterno() <= Len(In);
Load *, KPI_1&KPI_2&Correlation as In;
Load * Inline [
KPI_1,	KPI_2,	Correlation
A,	B,	0.5
B,	A,	0.5
A,	D,	0.6
C,	D,	0.5
D,	A,	0.6
];

NoConcatenate
final:
load *, if(Out=peek(Out,-1),Null(),Out) as test Resident tmp 
Where if(Out=peek(Out,-1),Null(),Out)<>Null() Order by Out; DROP Table tmp;