Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
daisy1438
Contributor III
Contributor III

How to sort the field by country?

Hi 

I have table with columns product and country.

Product,country 

A,India 

B,america,

C,Australia,

D,Canada 

My requirement is in a table country should be displayed by sorting order like first Australia ,second India  remains as usual .

 

Output in table box.

Country, 

Australia 

India

America

Canada 

 

 

 

 

3 Replies
Vegar
MVP
MVP

To get complete control of your country sorting you could add a sorting value to country table. Then use that one for defining the sort order. 

Product,country, CountrySortOrder

A,India, 2

B,america,3

C,Australia,1

D,Canada ,4

daisy1438
Contributor III
Contributor III
Author

Hi

In that table I was mentioned only 4 countries.

But actual table contains 100 countries.
Out off 100 countries first 3 India, america, Australia remains all
countries as usual.
How to do this?
pradeep_s
Creator
Creator

Hi @daisy1438 ,

In your data table, create a new column "sort order". against the three countries which you want to see first, update the "sort order" column with values 1,2,3. Then against rest of the countries you have the  "sort order" value as 4.

Now  you can do  ORDER BY.

In Script:

Load  * RESIDENT Table 

ORDER BY  "sort order" asc, Country asc.

In Table:

Sort  first by dimension sort order" asc, then by "Country" asc. 

This will work.

 

Thanks!