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 in Line Charts

Hi

I have a line chart with the following labels at the axis.

S L M 45 60 70 80 90 100 110 216

its currently sorted Numerically & Alphabetically but i want it specifically like this

The L must go to the front, then the numerical numbers in order then the S must be at the back after the 216 or 234

How on earth can i do this?

1 Solution

Accepted Solutions
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Simply u can use the wildmatch function in ur chart.

also refer the attached file. u can sort in any order as per ur wish without any script modification.

View solution in original post

12 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi Ruan,

PFA

I hope this helps.

Not applicable
Author

excellent

thanx alot, works like a charm. now for another twist.

S M L 50 60 70 80 90 100 110 120 130 140

The M will have to slot in the middle somewhere like between 90 and 100. is this possible?

deepakk
Partner - Specialist III
Partner - Specialist III

Yes,

if(num(Dim) <100,3, if(Dim ='M', 4,if(num(Dim) >=100,5)))

You can try out the above expr

Not applicable
Author

thanx in advance. Yes

johnw
Champion III
Champion III

Also consider doing a separate load before your main load where you just put the values in the order you want. Then after the main load, drop that table. Sort by "original load order". That lets you easily change the order of distinct values by simply changing their position in the list. See attached.

bullish35
Creator II
Creator II

If your dimension values are finite, here's a very simple solution. If you'd rather keep a single table, concatenate the 'SortOder' field. Ellen

johnw
Champion III
Champion III


Ellen Blackwell wrote:If your dimension values are finite, here's a very simple solution. If you'd rather keep a single table, concatenate the 'SortOder' field. Ellen


It seems like you've taken most of the disadvantages of both Deepak and my solutions and combined them.

Deepak's:
pro - values do not need to be known (if sort rule is simple)
pro - values do not need to be listed (if sort rule is simple)
con - possible extra load time (if adding to the original table and original table is large)
con - complication of data model (extra field or extra table)
con - can be more difficult to add values or change sort order (nested if)

Mine:
pro - trivial to add values or change sort order (insert new values where desired, move other values)
pro - "no" extra load time
pro - no complication of data model
con - values must be known
con - values must all be listed

Yours:
pro - ???
con - possible extra load time (if adding to the original table and original table is large)
con - complication of data model (extra field or extra table)
con - can be more difficult to add values or change sort order (may need to renumber a lot of values)
con - values must be known
con - values must all be listed

Am I missing some advantage of your approach?

bullish35
Creator II
Creator II

Pretty talented, am I not? Actually, I doubt that you are missing any hidden advantages. I'm still pretty new. I used this method because it was a really simple way to create the sort order I needed for a very small table. I do appreciate your Pro/Con lists - they have become part of my learning process. Take care. Ellen

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Simply u can use the wildmatch function in ur chart.

also refer the attached file. u can sort in any order as per ur wish without any script modification.