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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
danielact
Partner - Creator III
Partner - Creator III

Match with intervals at object level

I am currently using a Match function instead of nested if statements because my data source is enormous, and if statements really slow it down. Now I'd like to use an interval instead of just a number - so instead of using Match(Num,1,10,100,500) I'd like to be able to do within 5 of each value - so instead of 10, it would be between 5 and 14, etc.

Any idea on how to do that?

2 Replies
RedSky001
Partner - Creator III
Partner - Creator III

load *

          ,Qty - 5 as Start

          ,Qty + 5 as End;

A:

LOAD * INLINE [

    Qty

    10

    20,

];

B:

LOAD * INLINE [

    X

    10

];

 

IntervalMatch ( X ) load Start, End Resident A;

drop tables A, B;

Does this help?

Mark

Not applicable

Try to use Class function, where you basically create buckets. Here is example from help:

class(expression, interval [ , label [ , offset ]])

Creates a classification of expressions. The bin width is determined by the number set as interval. The result is shown as a<=x<b, where a and b are the upper and lower limits of the bin. The x can be replaced by an arbitrary string stated in label. 0 is normally the default starting point of the classification. This can be changed by adding an offset.

Examples:

class( var,10 ) with var = 23 returns '20<=x<30'

class( var,5,'value' ) with var = 23 returns '20<= value <25'

class( var,10,'x',5 ) with var = 23 returns '15<=x<25'