Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucky1
Creator
Creator

How to sort by - symbol

Hi

countryacronym field with values

US.ICE-FUTURES

US.Future

US-Miam

US.mik

 

I want to sort this by symbol like (.) should be 1st position  and _ should be last

Need my output like

CountryAcronym--this is my field name

US.Future

US.mik

US.ICE-FUTURES

US-Miam

 

 

Labels (5)
10 Replies
BrunPierre
Partner - Master II
Partner - Master II

Maybe?

Match(CountryAcronym, Dual('US.Future',1), Dual('US.mik',2), Dual('US.ICE-FUTURES',3), Dual('US-Miam',4))

Digvijay_Singh
MVP
MVP

May be create island table like this and associate to your data model by any suitable key - 

Load
Dual(CountryAcronym,[Sort Order]) as CountryAcronym inline [
CountryAcronym, Sort Order
US.Future, 1
US.mik, 2
US.ICE-FUTURES, 3
US-Miam, 4
];

Digvijay_Singh_0-1686180460893.png

 

 

Lucky1
Creator
Creator
Author

Thanks for your reply brunpierre

These are not static values.every month data will change so the country acronyms will change.so anything comes with . Should come 1 anything comes with - should come last

Lucky1
Creator
Creator
Author

Thanks for your reply digvijay

These are not static values.every month data will change so the country acronyms will change.so anything comes with . Should come 1 anything comes with - should come last

vinieme12
Champion III
Champion III

as below, Create a custom sort order field

Load 
Ticker
,if(index(Ticker ,'.'),1,2)&Ord(upper(Ticker))&Ord(coalesce(subfield(upper(Ticker),'-',2),subfield(upper(Ticker),'.',2)))  as Ticker_Sort_Order
inline [
Ticker
US.ICE-FUTURES
US.Future
US-Miam
US.mik
];

 

 

Under Sorting >> Choose Sort By Expresssion >> 

= Min(Ticker_Sort_Order)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Lucky1
Creator
Creator
Author

I found solution for this

If(wildmatch ([country acronyms],'*-*'),1)

Put sort expression in ascending order

vinieme12
Champion III
Champion III

this way you loose alphabetical sorting

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Lucky1
Creator
Creator
Author

Thanks for your reply viniemel2

We don't need to sort by alphabets

Lucky1
Creator
Creator
Author

Agree with u iam losing my alphabetical sorting.i have used 

 

Load 
Ticker
,if(index(Ticker ,'.'),1,2)&Ord(upper(Ticker))&Ord(coalesce(subfield(upper(Ticker),'-',2),subfield(upper(Ticker),'.',2)))  as Ticker_Sort_Order
inline [
Ticker
US.ICE-FUTURES
US.Future
US-Miam
US.mik
];

 Your expression and it is giving alphabetical sorting which is correct but in my scenario i need alphabetical except - thing.if i have -it should come last