# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Weird sorting Order in custom Dimension

Hi,

at the moment I use a custom dimension to do a bucket sorting in a bar chart. Looks like attached. But the sorting seems weird, it doesnt matter if I sort alphabetical or numerical. I think Qlik interprets the Buckets e.g. "0-1" weird, as text + value.

The field expression is:   =replace(class(Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID),1),'<= x <', '-')

Is there a way I can sort this correctly?

Thanks

Pericator

1 Solution

Accepted Solutions
Honored Contributor II

## Re: Weird sorting Order in custom Dimension

dual(replace(class(Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID),1),'<= x <', '-') , Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID))
Learning never stops.
7 Replies
Honored Contributor II

## Re: Weird sorting Order in custom Dimension

while creating the bucket may be create the bucket as dual('0-1',1) , dual('1-2',2), dual('2-3',3) and so on .. now it is considering them as string so anything starts with 0 will come first then 1 and then 2 and so on .
Learning never stops.
New Contributor III

## Re: Weird sorting Order in custom Dimension

I create the buckets in the field expression directly, see above, how can i define such buckets there?

=replace(class(Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID),1),'<= x <', '-')
Honored Contributor II

## Re: Weird sorting Order in custom Dimension

`dual(replace(class(Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID),1),'<= x <', '-'),subfield(replace(class(Aggr(Sum(DN_NUMBER_OF_SALES), DN_DEALER_ID),1),'<= x <', '-'),'-'))`

This may be

Learning never stops.
New Contributor III

## Re: Weird sorting Order in custom Dimension

Sadly this gives me multiple buckets between 0 and 1. See attached

Honored Contributor II