Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
Specialist
Specialist

how to compare two field values

Hello All,

          I need to write a expression in set analysis which should compare between two fields values let say

if field1 value = field2 value  and field2 value has more than one IP then  sum of values(field2=count(distinct ip)>1)

How to write above condition in set analysis plz...

Thanks

11 Replies
kunkumnaveen
Specialist
Specialist
Author

Any Suggestions plz

tresesco
MVP
MVP

May be like:

Sum({<KeyField={"=field1=field2"}, field2={"=count(distinct ip)>1"}>}Value)

Note: KeyField here is a field that would uniquely identify the records in the table.

kunkumnaveen
Specialist
Specialist
Author

thanks for reply,

actually KeyField is field1 i want to check whether field1 values are  present in field2 , if they are  present then i need to check  whether the values has more then one ip or not

kunkumnaveen
Specialist
Specialist
Author

is this right ?

Sum({<field1={"=field2"}, field2={"=count(distinct ip)>1"}>}Value)

tresesco
MVP
MVP

Try:

Sum({<field1={"=field1=field2"}, field2={"=count(distinct ip)>1"}>}Value)


and yes based on your requirement, you might have to put the same set condition in the inner count() as well, like:

Sum({<field1={"=field1=field2"}, field2={"=count({<field1={"=field1=field2"}>}distinct ip)>1"}>}Value)

kunkumnaveen
Specialist
Specialist
Author

if i need to write not equal then i mean if field1 values should not be in field2 ,

Sum({<field1<>{"=field1=field2"}, field2={"=count({<field1={"=field1=field2"}>}distinct ip)>1"}>}Value)

is above expression right for not present or not equal

tresesco
MVP
MVP

You could try:

Sum({<field1={"=field1<>field2"}, field2={"=count({<field1={"=field1<>field2"}>}distinct ip)>1"}>}Value)


However, let me tell you, field1<>field2 is not same as

'if field1 values should not be in field2'

For that you might have to use e()

kunkumnaveen
Specialist
Specialist
Author

sorry, may be my english is not good actually what i need to show is

one table

  show only values which are present in both the fields and ip>1

second table show remaining i mean

show all the field1 values which or not present in field2 and ip=1 or null

kunkumnaveen
Specialist
Specialist
Author

trying to write possible function but throwing error

sum({<field1=p({<field2>}),field2={"count(distinct ip)>1"}value)