Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
qv_testing
Specialist II
Specialist II

Class Function

Hi Community,

Use Of CLASS() Function,

please give me example, and which type of scenario's using CLASS() function..

Please can anyone explain.....

Thanks in Advance....

7 Replies
rustyfishbones
Master II
Master II

tresesco
MVP
MVP

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'

If any issues understanding from here, please let know.

Not applicable

Hi Tresesco,

can you please guide me on  the function  class(8,3,'y',2) ,how it will work?

Thanks

John

MarcoWedel

class(8,3,'y',2) will always deliver a dual value '8 <= y < 11' with an underlying value of 8.


regards


Marco

Not applicable

Hi Marco,

Can you please explain me in detail

how the lower and upper limits calculated

tresesco
MVP
MVP

Most of the confusion could probably be around offset, it is nothing but the number the interval starts from. Hence, taking it from there, in 'class(8,3,'y',2)' interval starts from 2; interval 3 will generate the intervals like: 2+3=5, 5+3=8, 8+3=11, ...

Now the number 8 belongs to 8-11. 'y' is just a label.

Hope this helps.

agomes1971
Specialist II
Specialist II

Hi,

please see this...

How to use Class() function

Regards

André Gomes