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: 
lmit
Creator II
Creator II

Compare 2 numbers or values

Hi all,

I have a small requirement where I need to compare 2 numbers and get the results, let’s say my input is like below

col1;col2

1;2

2;2

3;2

my output should be like

cok1;col2;results

1;2;1

2;2;0

3:2;-1

if 2 numbers are same it should return 0 , greater -1 and lesser +1

i tried using methods like greater or greaterorequal but not getting the exact results

can anyone suggest other methods

thanks,

lmit

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

Add a new column in the output table on tMap, and set its expression like this:

row1.col1==row1.col2?0:(row1.col1>row1.col2?-1:1)

 

Regards

Shong

View solution in original post

2 Replies
Anonymous
Not applicable

Hi

Add a new column in the output table on tMap, and set its expression like this:

row1.col1==row1.col2?0:(row1.col1>row1.col2?-1:1)

 

Regards

Shong

lmit
Creator II
Creator II
Author

Thanks @Shicong Hong​ ,