Using the sort expression you can sort your pivot table.
In the sort expression you can specify your sort order like numeric , text.
If you want to sort some specific manner means you can create the sort order variable for that particular field.
like Country SortOrder
You can mention this order in inline in script
Then you can use this sortOrder in sort exprssion