Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Sort Multiple columns

SamSurya
8 - Asteroid

I have a dataset as 

 

NamePeriodMonthMonth_Order
MangoJan_2020Jan1
AppleApr_2020Apr4
MangoFeb_2020Feb2
OrangeJan_2020Jan1
PeachFeb_2020Feb2
AppleMar_2020Mar3
AppleFeb_2020Feb2
MangoApr_2020Apr4
GuavaFeb_2020Feb2
GuavaJan_2020Jan1
MangoMar_2020Mar3

 

And I want to sort it basis name first and then Month Order as below result:

 

NamePeriodMonthMonth_Order
AppleFeb_2020Feb2
AppleMar_2020Mar3
AppleApr_2020Apr4
GuavaJan_2020Jan1
GuavaFeb_2020Feb2
MangoJan_2020Jan1
MangoFeb_2020Feb2
MangoMar_2020Mar3
MangoApr_2020Apr4
OrangeJan_2020Jan1
PeachFeb_2020Feb2
12 REPLIES 12
BrandonB
Alteryx
Alteryx

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. 

SamSurya
8 - Asteroid

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

BrandonB
Alteryx
Alteryx

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. 

 

sort.png

SamSurya
8 - Asteroid

Thank you ... its working now

Hangxing_Zhou
7 - Meteor

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! 

 

 

 

BrandonB
Alteryx
Alteryx

@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. 

Hangxing_Zhou
7 - Meteor

Got it, thank you Brandon

avo
7 - Meteor

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

 

 

BrandonB
Alteryx
Alteryx

@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

 

sort.png

Labels