Sorting By Date but grouping by another name/string
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Name | Date |
John | 2/8/2023 |
Sam | 1/31/2023 |
Kevin | 1/20/2023 |
Charlie | 1/20/2023 |
Chuck | 11/17/2022 |
Gerald | 11/11/2022 |
Kevin | 6/27/2019 |
Donald | 2/3/2019 |
Pat | 11/27/2018 |
Warren | 11/27/2018 |
Rick | 10/8/2018 |
Pat | 4/14/2016 |
Ideally what i would like to do is keep those names together DESPITE the date so it would look something like this
Name | Date |
John | 2/8/2023 |
Sam | 1/31/2023 |
Kevin | 1/20/2023 |
Kevin | 6/27/2019 |
Charlie | 1/20/2023 |
Chuck | 11/17/2022 |
Gerald | 11/11/2022 |
Donald | 2/3/2019 |
Pat | 11/27/2018 |
Pat | 4/14/2016 |
Warren | 11/27/2018 |
Rick | 10/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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Apologies, missed tagging you in the below, but I do have a follow up question below - thanks in advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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>?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
