Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple Range Selection

Hi, I have an requirement of selecting multiple range. My sales range should fall in this category (Range is a field which I need)

Range

0 - 20

0 - 40

0 - 60

0 - 80

0 - 100

Suppose if my sales is 10, then it should fall in all the 5 categories(i.e., all should be enabled).and if my sales is 70, then it should fall in the last two categories. I know that an if statement will not work. Is there any other functiion will do this.

1 Reply
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

I am not quite sure what you are trying to achieve here. There are a number possible approaches that may work for you.

First is having a separate Yes/No field for each band, eg:

LOAD
ID,
if(Sales <= 20, 'Yes', 'No') as Range0to20,
if(Sales <= 40, 'Yes', 'No') as Range0to40,
...

Or, if you want a single range field, with five entries for a sales value of 10 you could use the resident statement:

SalesTable:
LOAD
ID,
Sales,
...

Range:
LOAD
ID,
'0 - 20' as Range
RESIDENT SalesTable
WHERE Sales <= 20;

LOAD
ID,
'0 - 40' as Range
RESIDENT SalesTable
WHERE Sales <= 40;

Alternatively, you could not deal with the ranges in the load script, rather do it in expressions at the front end. The down side of that is that you would not be able to pick up on the ranges in list boxes and would be pretty much limited to showing the values in chart objects.

Hope that helps.

Cheers,
Steve