Hi All, I am struggling to find a way to custom sort data - see example data.
Category | Score |
positive | 0.5574 |
neutral | 0.2732 |
neutral | 0.25 |
positive | 0.5912 |
negative | -0.3612 |
positive | 0.7184 |
negative | -0.1419 |
negative | -0.2411 |
The scores range from -1 to 1. I would like to sort the categories as in the example below to show the following:
Negative score smallest to largest, positive score largest to smallest and neutral score largest to smallest.
I have considered assigning the number 1 to negative and 2 to positive etc. to achieve custom ordering for the categories, though still need to order the scores as mentioned above.
Category | Score |
negative | -0.3612 |
negative | -0.2411 |
negative | -0.1419 |
positive | 0.7184 |
positive | 0.5912 |
positive | 0.5574 |
neutral | 0.2732 |
neutral | 0.25 |
Thank you.
Solved! Go to Solution.
Hi @Lesleyc
There's two options. Either, do as you said by naming Positive as 1, Negative as 2 etc, then using a sort to sort by this 1,2,3 column AND by value descending.
Or, you could split them into 3 groups: Positive, negative, neutral, then sort these groups individually, then union them all together.
Hope this helps.
Since you want
Negative score smallest to largest, positive score largest to smallest
you'll need to split the data stream using a Filter tool, then use separate Sort tools in each data stream, then a Union tool.
Chris