4 Replies Latest reply: Aug 1, 2018 8:14 AM by Chanty 4u

# Bucket intervals

Hi Team,

I have Field called Bucket which is contain values like 1 to 10000

I want to make it as 1 to 999 as 1stBucket

1k to 2.9k as 2nd Bucket

3k to 5k  as 3rd Bucket

I want to display like above. Can anyone help me to get above

Thanks,

Siva

• ###### Re: Bucket intervals

Hi,

I would probably do this with an IF statement in the script unless you want exact intervals. Then you can use the Class Function - https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/ConditionalFunctions/class.htm

Script Example:

Temp:

LOAD * INLINE [

Number, Value

A, 100

B, 2000

C, 500

D, 250

E, 7500

F, 300

];

Fact:

*,

IF(Value <= 250,'1st Bucket',

IF(Value <= 500,'2nd Bucket',

'3rd Bucket')) AS Buckets

// Above you can define how you want them to be divided in the IF Statement.

Resident Temp;

Drop Table Temp;

Gives you this:

Best,

Ali A

• ###### Re: Bucket intervals

what's your expected output ?

• ###### Re: Bucket intervals

Create like this in script or chart:

IF(Bucket >= 1 and Bucket < 999, '1st Bucket',

IF(Bucket >= 1000 and Bucket < 2999, '2nd Bucket',

IF(Bucket >= 3000 and Bucket < 5000, '3rd Bucket',

'4th Bucket'))) as Bucket

Now create a chart

Dimension

Range

Expression

COUNT(Distinct Bucket)

• ###### Re: Bucket intervals

Have a look

Buckets