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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
saimahasan
Partner - Creator III
Partner - Creator III

comparing a value between a range

Hi all,

I am stuck with a problem. Tried to find the solution on community but couldnt get.

I have a variable wherein i have a value for eg 94.5.

Now i have two fields MinRange and MaxRange as follows:

Untitled.png

i have another fields Score and X_VAL

I need to check the range wherein the value 94.5 lies and accordingly display its score.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In the script, you can generate the "between" values in increments of .01 as a new field "Index". And then choose a Score from the table using a rounding of the variable like:

Only({<Index={$(=round($(vInput),.01))}>}Score)

See attached example.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

5 Replies
hic
Former Employee
Former Employee

Take a look at intervalmatch.  IntervalMatch

HIC

saimahasan
Partner - Creator III
Partner - Creator III
Author

But the value i want to compare is stored in a variable. and that variable is calculated in frontend.

So how will i compare a variables value with 2 fields??

hic
Former Employee
Former Employee

Then you need to express it with functions. One way is to use a nested If()-function - one If() per range.

Alternatively, you can use the class()-function. Or you can combine the two:

If(Variable<85,'Below',

If(Variable>=100,'Above',

Class(Variable,3, 'var', 1)

))

HIC

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In the script, you can generate the "between" values in increments of .01 as a new field "Index". And then choose a Score from the table using a rounding of the variable like:

Only({<Index={$(=round($(vInput),.01))}>}Score)

See attached example.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Anonymous
Not applicable

Simple correction:

"While (MinRange + (Iterno()*.01))-.01 < MaxRange" -> This should be <=MaxRange in order to consider the border case for Max Ranges