I have a dataset as
Name | Period | Month | Month_Order |
Mango | Jan_2020 | Jan | 1 |
Apple | Apr_2020 | Apr | 4 |
Mango | Feb_2020 | Feb | 2 |
Orange | Jan_2020 | Jan | 1 |
Peach | Feb_2020 | Feb | 2 |
Apple | Mar_2020 | Mar | 3 |
Apple | Feb_2020 | Feb | 2 |
Mango | Apr_2020 | Apr | 4 |
Guava | Feb_2020 | Feb | 2 |
Guava | Jan_2020 | Jan | 1 |
Mango | Mar_2020 | Mar | 3 |
And I want to sort it basis name first and then Month Order as below result:
Name | Period | Month | Month_Order |
Apple | Feb_2020 | Feb | 2 |
Apple | Mar_2020 | Mar | 3 |
Apple | Apr_2020 | Apr | 4 |
Guava | Jan_2020 | Jan | 1 |
Guava | Feb_2020 | Feb | 2 |
Mango | Jan_2020 | Jan | 1 |
Mango | Feb_2020 | Feb | 2 |
Mango | Mar_2020 | Mar | 3 |
Mango | Apr_2020 | Apr | 4 |
Orange | Jan_2020 | Jan | 1 |
Peach | Feb_2020 | Feb | 2 |
Solved! Go to Solution.
https://help.alteryx.com/2020.2/Sort.htm
The sort tool allows you to sort as many columns as you want in whatever order is desired.
Hi
I have edit my question in the post.Please check, also I've used sort tool but output does not seems to be correct
You will want to make sure that the fields you want to be sorted first are higher. I believe that this is the setting you want to use.
Thank you ... its working now
Hi Brandon,
To continue this question, I have another additional requirement, not sure which tool is better for it.
The requirement is, I only need remain the last record for each name after this multiple sorting.
For example,
for "Apple", only keeps "Apr_2020", for "Guava", only keeps "Feb_2020"....
I have huge volumes for the "name", each one has lots of records(by date), I only need the last one for each.
thank you very much!
@Hangxing_Zhou after using a sort tool you can use a sample tool that can take one record from each group specified. You set N = 1 in the sample tool configuration and check the boxes for the column that you only want one row for each value.
Got it, thank you Brandon
Hi Brandon,
Could you please help?
I tried exactly what you suggest and looks like I didn't something incorrect ?
My last column (Units) still doesn't work , it is not in the right order ( Ascending).
Do i miss anything in my workflow to make it works well ? ( please find my attached sreenshot below)
thank you so much.
Anh
@avo your example is actually properly sorting. Each sort is within the context of the previous sort. You can see that your second column is being sorted and then your Units column is sorted ascending afterwards