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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

scenario

Hi Friends,

Here I have a scenario's please help me out on this ?

I have table like this

 

sivar23
rama24
krishna22
rao25
karthik10

parvathi12

deepthi15
nkhil16
vijay28
pavan27
Chandra30
ramana33

my requirement is need to create another column (age group)

in that my output should be like this.

age 10 -15 

age 16 -20

age  21-25

age 26-30

age 31-35

like this new field get age groups corresponding to the names?

2) what is class function in qlik view ?

4 Replies
tresesco
MVP
MVP

Try like:

Load *, 'Age '& Replace(Class(Age, 5), '<= x <','-') as Class Inline [

Name, Age

sivar, 23
rama, 24
krishna, 22
rao, 25
karthik, 10

parvathi,12

deepthi, 15
nkhil, 16
vijay, 28
pavan, 27
Chandra, 30
ramana, 33

]

Anonymous
Not applicable
Author

Class should be able to help you classify those age groups.

From Qv help file:

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'

Try this:

Test:
load Class(Age,5) as Bucket;
LOAD * INLINE [
Name, Age
sivar , 23
rama , 24
krishna , 22
rao , 25
karthik , 10
parvathi, 12
deepthi , 15
nkhil , 16
vijay , 28
pavan , 27
Chandra , 30
ramana , 33
]
;

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Below link will help you to understand class function.

Class Function

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks