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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare 2 rows of same column using SET ANALYSIS ?

Hi,


I am actually trying to see how I can compare 2 different rows of same column in a same table using SET ANALYSIS.

Table1:

Id             Name      PropId

1              JOHN      1000

2              JAKE      1000

3              MIKE      10011

4              AMY       10011



I need to check if 'Propid' column having same value then display 'Name'

for example

=If(   (If(Id=1 , PropId)) = (If(Id=2 , PropId))  , Name)

but it is not working. Please Help!


Thanks in Advance



1 Solution

Accepted Solutions
swuehl
MVP
MVP

Have you tried what I've suggested above? A set expression with p() function, like

=Concat({1<PropId = p({<Id = {1}>})>} DISTINCT Name,', ')


Instead of the hard coded value for Id = 1, you can use a variable you set when loading your data:


=Concat({1<PropId = p({<Id = {$(vIdPassedDuringLOAD)}>}) >} DISTINCT Name,', ')

View solution in original post

27 Replies
Anil_Babu_Samineni

I need to check if 'Propid' column having same value then display 'Name'

If(PropId = Id, Name)

=If(   (If(Id=1 , PropId)) = (If(Id=2 , PropId))  , Name)

From this, What are you trying? May be?

If(Id=1, If(Id=2, PropId, Name))

Or

If(Id=1, ProdId, If(Id=2, ProdId, Name))

Or

If(Id=1 and Id=2, ProdId, Name)

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
neha_shirsath
Specialist
Specialist

Hi Sheela,

Can you tell me what will be output in this case?

Means now in given case for id1& id2 propid is 1000 then you want to display  Name-JOHN and JAKE?

And if its not equal to then??

like suppose i have below table-

Table1:

LOAD * Inline [

Id       ,      Name,      PropId

1         ,     JOHN ,     1000

2          ,    JAKE  ,    1000

1        ,      ABC,        1001

3           ,   MIKE   ,   10011

4            ,  AMY     ,  10011

];

So what will be the output for ABC  name?

Thanks,

Neha

Not applicable
Author

Hi Anil,

Thanks for reply.

For Example:

                         I will pass Id as 1.

                         PropId is 1000 for Id 1.

                         If PropId Column contains value 1000, display all those related name.

Now If i pass id as 1, i need to display names JOHN and JAKE.

Now If i pass id as 3, i need to display names MIKE and AMY.

Not applicable
Author

Hi neha,

Table1:

LOAD * Inline [

Id       ,      Name,      PropId

1         ,     JOHN ,     1000

2          ,    JAKE  ,    1000

1        ,      ABC,        1001

3           ,   MIKE   ,   10011

4            ,  AMY     ,  10011

];

So what will be the output for ABC  name?

Just display ABC.

Now If i pass id as 1, i need to display names JOHN and JAKE.

Now If i pass id as 3, i need to display names MIKE and AMY.

Thanks

Sheela

swuehl
MVP
MVP

You can use the p() function to retrieve related PropId for selected Id, if you then clear selection in Id, you can get the record set with all records with related PropId to selected Id:

=Concat({<PropId = p(PropId), Id= >} DISTINCT Name,', ')

neha_shirsath
Specialist
Specialist

So, your expected output look like-

Id PropId Name
11000JOHN
11001ABC
11000JAKE
310011MIKE
310011AMY

Correct me if i'm wrong.

I'm just understanding exactly what your expected output.

Thanks,

Neha

Not applicable
Author

Hi Neha,

No. I have a straight table. Need to display top 5 members. I am passing Id while loading.

Say am passing Id as 1(Id=1). PropId is 1000 for Id 1. I want to display top 5 names whose Propid is 1000

Thanks

Sheela

Anil_Babu_Samineni

Look Dimension Limits on your object properties. Or use Rank to get top 5 ranks with may be wildcard search. Can you send the formule which you used. May be better if you would provide sample

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
neha_shirsath
Specialist
Specialist

Hi Sheela,

So basically you want top n members for whom your for eg. id=1 & propid=1000.

See the attached file,hope it will help you.

Thanks,

Neha