Sort - > Expression ->
Try like this:
if(Model='26 K',6, ////and so on.......
Then sort is ascending or descending
test.png 162.0 K
Try like this, add below script in your script
12 i, 2
Total <2, 3
25 k, 5
26 k, 6
29 k, 7
Total 2-3, 8
25 j, 10
26 j, 11
29 j, 12
Total 3-4, 13
Total model, 14
Now in Pivot table Sort Tab select give Order in Expression text box.
Hope this helps you.
You will always have to change some code or configuration (either externally or internally) as there is no relation between the Model value and the sort order. What place will arbitrary new Model value xyz (replace with any possible value) get? If you can describe that logic, you can program a dynamic ordering solution.
At the beginning of you script add this:
LOAD * INLINE [
This sets the load order for the elements of the field Model. At the end of the script
DROP Table Temp;
This gets rid of the temporary table but QlikView retains the load order of the field values. Now when you want to sort in a chart set the sort order of the field Model to Load Order.
try this. You can use it with a range from I think <1 to 8-9 and 1 A to 999 z
//SORT ORDER //ZYXXXWWW //Z....... number range //.Y...... head or total flag (0 or 9) //..XXX... int based range sort (Must be between 0 and 999) //.....WWW char based range sort (Ord(chr) must be between 0 and 999) Sort: LOAD Model, if(IsNum(Left(Model,1)), //Check for number as start if(IsNum(Mid(Model,2,1)), //check if second char is a number (Num#(Left(Model,1)) * 10000000) + (Num#(Left(Model, Index(Model,' '))) * 1000) + (Ord(Mid(Model, Index(Model,' ') + 1, 1))), // Make sort int based on string like [int][int][char] Num#(Left(Model,1)) * 10000000), //Make sortorder based on first int if(Left(Model, 1) = '<' , //check for '<' as start (Num#(Mid(Model, 2, 1)) - 1) * 10000000, //make sort order for <[int] ([int] - 1) if(IsNum(Mid(Model, Index(Model,' ') + 1, 1)), //check for number after space (like total [int]-[int]) (Num#(Mid(Model, Index(Model,' ') + 1, 1)) * 10000000) + 9000000, //make sort int based on first int after space if(Mid(Model, Index(Model,' ') + 1, 1) = '<', //check for '<' after space (like <[int]) (Num#(Mid(Model, Index(Model,' ') + 2, 1) - 1)* 10000000) + 9000000, //make sort int based on first int after '<' 99999999)) // sort order for last line (like total model) ) ) as ModelSort Inline [ Model <2 12 i Total <2 2-3 25 k 26 k 29 k Total 2-3 3-4 25 j 26 j 29 j Total 3-4 Total model ];