Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have 3 columns in straight table. Team, Date, Result. Need the Sorting that Result column as primary sort that only only Won, Lost should appear as first and Tie, No Result should come second and Date column should be as secondary sort where old dates should comes at first as ascending. below are my input n needed output. please help
Input:
Team | Date | Result |
IND | 5/25/2022 | Lost |
CHI | 5/15/2022 | Tie |
UK | 4/22/2022 | Lost |
IND | 4/31/2022 | Won |
UK | 5/3/2022 | No Result |
USA | 4/30/2022 | Tie |
CHI | 5/31/2022 | Won |
USA | 6/1/2022 | No Result |
UK | 6/30/2022 | Lost |
After Sort Output need as below :
Team | Date | Result |
UK | 4/22/2022 | Lost |
IND | 4/31/2022 | Won |
IND | 5/25/2022 | Lost |
CHI | 5/31/2022 | Won |
UK | 6/30/2022 | Lost |
USA | 4/30/2022 | Tie |
UK | 5/3/2022 | No Result |
CHI | 5/15/2022 | Tie |
USA | 6/1/2022 | No Result |
Please help.
Looking for the same issue. Bumped into your thread. Thanks for creating it. Looking forward for solution. CredibleBH Employee Login
you would normally use a sort by expression. most that i have seen have sort weight associated to individual values (Won before lost, etc..). however, yours is sorted by a grouping of values and i noticed that Qlik Sense sorts the group and then sorts the individual Values. so the order becomes Lost, Lost, Lost, Won, Won,...
the result order is correct but the date order was amiss. what i had to do was bias the date as well:
notice I ordered it by date first so as to overcome the sorting by values of Result, then i added this as the sort expression for Date:
=if(Result='Lost' or Result='Won',1,2)*10000000 + num(Date)
i didnt even need to sort by Result as that was baked into the sort expression for Date.
you can of course play around with the same idea until you get to an acceptable solution
follow on, i did this obviously in QLik sense