Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Sorting based on different column in previous row

Reinierk
7 - Meteor

Hi All,

 

Need some help sorting data based on a different column and previous row.

 

Attached is a sample of what the data looks like and what I want to achieve as a result.

 

Thanks in Advance

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@Reinierk,

 

I'd create a metadata input that includes a SORT_ORDER field for column A.  Home = 0, First = 1 etcetera.  Using a Find Replace tool, I'd add that field to the initial table and sort on the new SORT_ORDER field.  Once the field is used, you can de-Select it.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JohnKTran
6 - Meteoroid

Any luck with this? I also have data that has not been sorted, my project requires data in a similar format:

 

Raw Data

Starting StationStopping Station
SandringhamHampton
BrightonElsternwick
RipponleaGardenvale
HamptonBrighton
ElsternwickRipponlea

 

 

Sorted Data - Objective

Starting StationStopping StationJourney
SandringhamHampton1
HamptonBrighton2
BrightonElsternwick3
ElsternwickRipponlea4
RipponleaGardenvale5

 

Can anyone help us with an example workflow?

Reinierk
7 - Meteor

Hi @JohnKTran,

 

The solution to this is an iterative macro.

 

Please see attached.

 

Reinier.

JohnKTran
6 - Meteoroid

Thank you very much!

JohnKTran
6 - Meteoroid

Hey ReinierK, 

 

Just wanted to confirm with you that the following is the logic behind the workflow:

 

- You have programmed the workflow such that the input list is effectively joining for the second column's record in the first column using the sample tool to skip the first row and attaching it back into the list to find itself... 

- The iterative macro is required because you are effectively using the 2nd columns first row to do a vlookup (in excel land) of itself in the first column which will then loop the "remaining" records to find itself again...

 

Just wondering how I can explain the logic behind this to others...keen to hear your thoughts & explanation.

Labels