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

Rank function for non-numeric values

Hello,

I have a Segment field with values 'H', 'M', 'L'

To sort these, I am not able to use load order, alphabetical, etc. Without adding an INLINE table to the script, is it possible to use tha Rank function to order my segments like H, M, L in my table?

Many thanks

Mel

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can use an expression to sort the chart. On the Sort tab choose the option Sort By Expression and use this expression: =match(only({1}Segment), 'H','M','L')


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
MK_QSL
MVP
MVP

Use as below..

Load

  Dual(Field,Ord(Field)) as Field

Inline

[

  Field

  H

  M

  N

  X

  Z

];

Now you can sort by ascending or descending order.

Not applicable
Author

Hi Manish,

Thank you very much for this. I'm not able to touch the load script, however. Is it possible to accomplish similar from a calculated dimension or from Sort at a chart level?

Thanks

Mel

Not applicable
Author

Hi mvankluyve,

you won't be able to use rank like this, you could potentially load your field as a dual() so that each value does have an underlying numerical value for you to sort using.

The other option you have is to sort via an expression and define the order within this.

Hope that helps

Joe

Gysbert_Wassenaar

You can use an expression to sort the chart. On the Sort tab choose the option Sort By Expression and use this expression: =match(only({1}Segment), 'H','M','L')


talk is cheap, supply exceeds demand
Not applicable
Author

Brilliant - thanks so much, Gysbert!