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: 
Anonymous
Not applicable

Display data corresponding to common keys

I have a data having given data

Data      Key

A               1

A               2    
A               3    

B               1

B               2    

B               4    

C               1

C               2

C               5

and I want to have a table showing those data rows that have common keys like

Data         Key

A               1

A               2

B               1

B               2

C               1

C               2

so what should be the approach for it?

5 Replies
shiveshsingh
Master
Master

Have you tried it yourself?

big_dreams
Creator III
Creator III

Is this interview question or exam question???

Chanty4u
MVP
MVP

am not sure about logic  but  try this

Test:

LOAD * INLINE [

    Data, Key

    A, 1

    A, 2

    A, 3

    B, 1

    B, 2

    B, 4

    C, 1

    C, 2

    C, 5

]

Where Key<=2;

key.JPG

big_dreams
Creator III
Creator III

Try below

Test:

Load * Inline [

Data,Key

A,1

A,2    

A,3   

B,1

B,2   

B,4   

C,1

C,2

C,5

];

Left Join

Load count(Data) as cnt,Key Resident Test

group by Key

;

Temp:

Load max(cnt) as maxcnt Resident Test;

let vMaxCnt = Peek('maxcnt',-1,'Temp');

Final:

Load Data,Key Resident Test

where cnt=$(vMaxCnt);

Drop table Test,Temp;

Regards,

Anonymous
Not applicable
Author

Not sure if this is smth u r looking for...

Test:

Load * Inline [

Data,Key
A,1
A,2 
A,3 
B,1
B,2 
B,4 
C,1
C,2
C,5
]
;


temp:
Load Only(Data) as uData, Key
Resident Test
group by Key
;

temp1:
Load isnull(uData) as nData, Key as Key2
Resident temp
where Len(uData)<=0
;