Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Pericator
Contributor III
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
pradosh_thakur
Master II
Master II

what about
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.

View solution in original post

7 Replies
pradosh_thakur
Master II
Master II

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.
Pericator
Contributor III
Contributor III
Author

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 <', '-')
pradosh_thakur
Master II
Master II

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.
Pericator
Contributor III
Contributor III
Author

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

pradosh_thakur
Master II
Master II

what about
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.
Pericator
Contributor III
Contributor III
Author

seems to work, thank you very much Pradosh
pradosh_thakur
Master II
Master II

Always My friend. 🙂
Learning never stops.