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

Custom Sort

Hi all,


I am trying to create a custom sort in my list box based on the below expression...


I have used the following expression in the sort tab on the list box, but it does not seem to want to sort my field... see below..

What am I doing wrong? It sorts the equations by starting from the 2-3; 6-10; 11-20; 4-5; 0-1;



dual(DEM_TENURE, Index('0 to 12 to 34 to 5 to 1011 to 20Above 20',lower(DEM_TENURE)))


=IF(DEM_TENURE <= 1, '0 to 1 ',
IF(DEM_TENURE <= 3, '2 to 3 ',
IF(DEM_TENURE <= 5, '4 to 5 ',
IF(DEM_TENURE <= 10, '6 to 10 ',
IF(DEM_TENURE <= 20, '11 to 20 ',
'Above 20 ')))))

Thank you

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

I assume that the DEM_TENURE expression is the one you want correctly sorted. I would integrate the Dual() into the expression itself:

=IF(DEM_TENURE <= 1, Dual('0 to 1 ', 0),

IF(DEM_TENURE <= 3, Dual('2 to 3 ', 2),

IF(DEM_TENURE <= 5, Dual('4 to 5 ', 4),

IF(DEM_TENURE <= 10, Dual('6 to 10 ', 6),

IF(DEM_TENURE <= 20, Dual('11 to 20 ', 11),

Dual('Above 20 ', 20))))))

Now select the numerical option for the sort.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
sushil353
Master II
Master II

Hi,

Do you want to sort your dimension in order 2-3; 6-10; 11-20; 4-5; 0-1 ?

which expression are you using as sort expression ?

share a sample app if possible

prashantbaste
Partner - Creator II
Partner - Creator II

Hi

I think you need to write an expression in sort as -

=IF(DEM_TENURE <= 1, 1,
IF(DEM_TENURE <= 3, 2,
IF(DEM_TENURE <= 5, 3,
IF(DEM_TENURE <= 10, 4,
IF(DEM_TENURE <= 20, 5, 6)))))


here in this expression 1,2,3,4,5,6 are position satisfying conditions ...


Hope this will be helpful for you.

--

Regards,

Prashant P Baste

jonathandienst
Partner - Champion III
Partner - Champion III

I assume that the DEM_TENURE expression is the one you want correctly sorted. I would integrate the Dual() into the expression itself:

=IF(DEM_TENURE <= 1, Dual('0 to 1 ', 0),

IF(DEM_TENURE <= 3, Dual('2 to 3 ', 2),

IF(DEM_TENURE <= 5, Dual('4 to 5 ', 4),

IF(DEM_TENURE <= 10, Dual('6 to 10 ', 6),

IF(DEM_TENURE <= 20, Dual('11 to 20 ', 11),

Dual('Above 20 ', 20))))))

Now select the numerical option for the sort.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein