Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create Age Bucket using Listbox Object?

Hi,

I am new to Qlikview, My requirement is:

I have a table Called age.

Age:

LOAD * INLINE [

    Age

    11

    11

    16

    18

    19

    20

    21

    26

    28

    29

    30

    35

    38

    40

    42

    48

    50

    52

    60

];

Now I want create a Bucket Using class Function in Listbox, Can please let me know. Step by step.

Requirement is like:

List Box:

Age

11-20 | 21-30 |31-40 | 41-50 | 51-60 Like this type i need.

Thanks,

Kumor

14 Replies
ashwanin
Specialist
Specialist

Use class fucntion

Dual(Replace(Class(Age,10),'<= x <','to'), Num(Class(Age,10))) as Bucket

Script should be :

BUCKET:

LOAD * INLINE [

        Age

        11

        11

        16

        18

        19

        20

        21

        26

        28

        29

        30

        35

        38

        40

        42

        48

        50

        52

        60

];

load *,

Dual(Replace(Class(Age,10),'<= x <','to'), Num(Class(Age,10))) as Bucket

resident BUCKET;

robert_mika
Master III
Master III

Listbox--->Field-->Expression

Type

=class(Age,10,'Age',11)

This is the closer you can get

10-Apr-15 8-48-35 AM.jpg

You can change the expression to

=class(Age,10,'Age',10) to have bucket every 10 years

10-Apr-15 8-53-01 AM.jpgS

Age- is your field

10- is the bucket (every 10

'Age' is the text you can have between(you can change that to anything you like)

10- number where you want to start from

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Hi ,

By using Class Function we can solve this Problem.

EX:

In List Box >>> Properties >> Field>>>Expression>>>Class(Age,Range,'Age',Range+1)

Regards,

Nagarjuna

ankitaag
Partner - Creator III
Partner - Creator III

Hello Reddy,

Create a ListBox, in the General tab select Expression in field dropdown and write

=Class(Age,10,'Age',11)

as an expression.

This will give you the below result:

Since the upper limit is not included in the range that's why the result says Age >=11 and <21

and that upper limit is included in the next range which says Age >=21 and <31

listbox.PNG

Not applicable
Author

Thanks Ashwani Kumar

Not applicable
Author

Thanks to all.

Not applicable
Author

Can you guys suggest me What type scenarios We can use ? What is the Use? Why ? is there any limitations?

ankitaag
Partner - Creator III
Partner - Creator III

The class function is mostly used when you need to calculate the aging of your inventory. In simple words when you need to check that the items or products which you have are how much old, so that you can take better decisions that whether you need to discard those too old items or how to sell them.

Also, when you need to make a range for students' marks, to identify in which score range the student fall.

Awesome function with the help of which you can make range buckets on the fly.

Not applicable
Author

I agree with your terms,  Can you tell me in Advanced Level, Present u told me that, i think as Beginner Level, Kindly Give Bit Explanation in Advanced Script Level.

Thank you