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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting Buckets ?

Hi All,

0-3 Months, 3-6 Months, 6-9 Months, 9-12 Months,1-2 Years,2-3 Years..

all are coming Randomly..I need to sort ?

Regards,

Helen

1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

Hit the Sort tab and only check expression, select 'ascending',  and enter an expression that will do this for you.For these values

Maybe something like

if(  right( [Field], 6) = 'Months',  left([Field],1)*1 ,  left([Field],1) *100)

They will be sorted as follows:

Value                      Sort order

0-3 Months             0

3-6 Months             3

6-9 Months             6

9-12 Months           8

1-2 Years                100

2-3 Years..              200


it will work but its just one quick way. Otherwise you can build a bigger IF statement or a load a mapping table

View solution in original post

2 Replies
Not applicable
Author

HI Helen,

You can use Dual(BucketField,BucketsortOrder) inside the script to achive what you want.

For example Dual(0-3 Months,1)....Dual(2-3 Years,5)

JonnyPoole
Former Employee
Former Employee

Hit the Sort tab and only check expression, select 'ascending',  and enter an expression that will do this for you.For these values

Maybe something like

if(  right( [Field], 6) = 'Months',  left([Field],1)*1 ,  left([Field],1) *100)

They will be sorted as follows:

Value                      Sort order

0-3 Months             0

3-6 Months             3

6-9 Months             6

9-12 Months           8

1-2 Years                100

2-3 Years..              200


it will work but its just one quick way. Otherwise you can build a bigger IF statement or a load a mapping table