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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
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



27 Replies
Not applicable
Author

Hi Sheela,

You can use swuehl 's code for getting your result.

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

and for top 5 results set max number to 5 in presentation tab.


Regards,

Anurag

Not applicable
Author

Hi Neha,

I am not using licence version of qlikview. Please could you share code if possible?

Thanks

Sheela

Not applicable
Author

As long as there is direct relation between ID and Name we cant not achieve this.

We can use Set analysis only for Aggregations. Not possible in this case.

Try to create two separate tables and those Name and ID should be related through ProdID.

Name:

LOAD

    Name,

    ProdId

FROM [lib://Test/Test.xls]

(biff, embedded labels, table is Sheet2$);

ProdID:

LOAD

    ID,

    ProdId

FROM [lib://Test/Test.xls]

(biff, embedded labels, table is Sheet2$);

Not applicable
Author

Hi Anurag,

Thanks for reply!

It will work. But my requirement is different. I want to check equality condition like

   If(Id=1, [propid])  =  If(Id=2,[propid])

If it is true display name.But it is not working , i think syntax is not correct.

Please Help!

Thanks

Sheela

Anil_Babu_Samineni

in fact, Syntax should this

If(Id=1, [propid], If(Id=2,[propid])

Or

If(Match(Id,'1') = Match(Id,'2'), [prodid])

Or else you may provide exact output you want to see

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
Not applicable
Author

Hi Anil,

Thank you so much for reply!

I want to check for equality condition like -  If Id 1's propid equal to Id 2's propid then display 'Name'.

Like

If (  If(Id=1,[propid] )  ==  If(Id=2,[propid])   ,Name )

Please help!

Anil_Babu_Samineni

i am sure, This is disgusting. But you can try or provide sample data

If(Only({<Id = {'1'}>}propid) = Only({<Id = {'2'}>}propid), 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
Not applicable
Author

Hi Anil,

Yes! My requirement matches the expression but it is not working:(

Thanks

Sheela

Anil_Babu_Samineni

I would suggest you to create dummy and share in excel so that we can work on it. I am sorry if you are not able to share the data set. This case, May be other can help you

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
Not applicable
Author

Hi Anil,

Sample data.

  

IdProp ID Name
13211 singnaklong
23211 donlaya
33211 tiwari
43545 rahul
53545 mohammed
63545 najma
73559 Nina
83559 benny
93559 zhou
103559 rex
113559

stefi

Thanks

Sheela