Alteryx Designer Desktop Discussions

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

Sorting By Date but grouping by another name/string

Nmassarone
8 - Asteroid

Hello, i have tried looking for this answer but cant seem to find it anywhere. I'm trying to see if there is a way to take a set of data that have and sort it BY DATE (Descending) but keeping certain groups together (while still keeping the sort by date structure)

 

I posted an example below of what I'm looking for, the actual data i have it thousands of rows so this would just be a snipped but ideally what i would like is to sort by the date DESCENDING but keeping certain groups together if there are multiples

so for the example below just sorting by the date takes the name Kevin and Pat and splits them up but i want to keep those names together despite the date being further back.

Right now you can see just by sorting by date splits up the names Kevin and Pat

NameDate
John2/8/2023
Sam1/31/2023
Kevin1/20/2023
Charlie1/20/2023
Chuck11/17/2022
Gerald11/11/2022
Kevin6/27/2019
Donald2/3/2019
Pat11/27/2018
Warren11/27/2018
Rick10/8/2018
Pat4/14/2016

 

Ideally what i would like to do is keep those names together DESPITE the date so it would look something like this

NameDate
John2/8/2023
Sam1/31/2023
Kevin1/20/2023
Kevin6/27/2019
Charlie1/20/2023
Chuck11/17/2022
Gerald11/11/2022
Donald2/3/2019
Pat11/27/2018
Pat4/14/2016
Warren11/27/2018
Rick10/8/2018


If anyone could help with this i tried different things in designer and tried looking for an answer but cant seem to find one any help would be appreciated!

Thank you

9 REPLIES 9
DataNath
17 - Castor

Hey @Nmassarone, in order to keep the names together, you just need to sort by [Name] in your Sort tool before sorting by [Date], so the configuration would look as so:

 

1238.png

 

If your dates are in the above format then you'll need to parse it to ISO format so that Alteryx can actually deal with it. From there, you'd sort on that field instead and then could just use a Select to remove it again:

 

1238-1.png

cjaneczko
13 - Pulsar

Does this do what you are looking to do?

 

image.pngimage.png

cjaneczko
13 - Pulsar

@DataNath I think they are looking to sort by date first, then if there is another instance of that name in the field, group the name with the field and sort the dates descending for that name. But not actually sort the data by name. Its a little bit more complex then just Name > Date.

Nmassarone
8 - Asteroid

Hey @DataNath appreciate the response so the only thing is i want to keep the Date sort by so the only thing is see how Donald (row3) this should be more towards the bottom (right above the 2 Pat rows) and the Sam row should be row 2 not towards the bottom im trying to keep the Date From Newest to Oldest WHILE keeping the multiple names together


Nmassarone
8 - Asteroid

@cjaneczko  PERFECT! this worked and sorted how i wanted appreciate everyone's help in this was spinning my head on this one appreciate the help

 

THANK YOU

marajmolinaro
5 - Atom

Hi there,

Thanks for this! It is working as long as there are only 2 names, but in my file I have more than that - any chance you have a solve if there is another of the same name much farther down the file?

 

Thanks!
Mara

marajmolinaro
5 - Atom

Apologies, missed tagging you in the below, but I do have a follow up question below - thanks in advance!!

Nmassarone
8 - Asteroid

Hi Mara, my file had more than 2 names in it some were separated but i got the results fine .... a suggestion would be to first sort by the name column have its own sort tool just by name to get all the names together and then run through the rest of the listed tools>?

marajmolinaro
5 - Atom

I did try that and it then sorted the whole file by name then date, which I need it the reverse, by date, then groups of names. 

 

When I ran it as is, it's working well for Alessia, but for Alessio, since he has multiple rows the third row is pulling the -1 record ID when actually I would want it to pull the original record ID for his name. If the names are close enough together (meaning the nominations came in close together), then it's not an issue, it's only if the date gap is high enough and there are more than 2 lines for the employee.

2024-05-14_15-54-04.jpg

Labels