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

Doing a float comparision

Hi, i think im going crazy, truly.

Im just trying to evaluate a column that has numbers and text. The text values are evaluated as 'NO_NUM' but the number values are clasified in some ranges. This is what i have right now:

if(IsNum(VAR),

if(num#(VAR,'#.#')<2.0,'RANGE1',

if(num#(VAR,'#.#')<3.0,'RANGE2','RANGE3'))

,'NO_NUM')

This doesnt work, every comparision i do i with the numbers for example x >5 returns true eventhough x is 2.

I just dont know what else to do, also have tried multiplying the numbers by 1 or adding 0 and for some reason a number like 0.6 is changed to 6.

Hope you can help me out.

Expected output:

VAROUTPUT
0.0RANGE1
1.5RANGE1
3.0RANGE3
PANO_NUM
4.0RANGE3
2.0RANGE2
2.5RANG2
NPNO_NUM

Edited by: Rubiel Velasquez

1 Solution

Accepted Solutions
sunny_talwar

This seems to work for me

Table:

LOAD *,

If(IsText(VAR), 'NO_NUM',

If(VAR < 2, 'RANGE1',

If(VAR < 3, 'RANGE2', 'RANGE3'))) as OUTPUT;

LOAD * INLINE [

    VAR

    0.0

    1.5

    3.0

    PA

    4.0

    2.0

    2.5

    NP

];

View solution in original post

4 Replies
sunny_talwar

Would you be able to share few rows of data with the output you expect to see from it?

Anonymous
Not applicable
Author

Just added few rows as example in the original post. Thanks

sunny_talwar

This seems to work for me

Table:

LOAD *,

If(IsText(VAR), 'NO_NUM',

If(VAR < 2, 'RANGE1',

If(VAR < 3, 'RANGE2', 'RANGE3'))) as OUTPUT;

LOAD * INLINE [

    VAR

    0.0

    1.5

    3.0

    PA

    4.0

    2.0

    2.5

    NP

];

Anonymous
Not applicable
Author

I swear i've tried that before trying to use the num# fuction. It totally worked! Thanks so much