Alteryx Designer Desktop Discussions

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

Find the value in Column X when the value in column Y is the maximum value in the column

khuebsch5
6 - Meteoroid

So I've got three fields: User ID, Department Code, and Punch Date.

 

The user's department codes shift over time, so I need to find the most recent code they were assigned. My thought is to identify the most recent punch date, then select the department code for that row of data, but I'm having trouble coming up with the logic to show that in Alteryx. Does anyone have thoughts on this?

 

Ex data:

 

User IDDept CodePunch DateRecent Code (Output)
123411055/4/20212002
123420023/15/20222002
123420023/20/20222002
123411069/22/20212002
123411055/27/20212002
144511052/15/20221105
1445110812/9/20211105
144511082/7/20221105
198420033/27/20222003
198420031/30/20222003
198411056/19/20212003

 

Thanks!

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

Hi @khuebsch5 

 

My approach would be to follow the following process.

 

1. Convert your date to an Alteryx date with Datetimeparse([Punch Date],'%m/%d/%Y')

2. Now find the max date for each User ID with a Summarize tool (GroupBy User ID, Max date)

3. Use a join tool to join the result from the Summarize back to the original dataset, matching on User ID and Date

 

Have a go and see how you get on.

 

Happy Alteryxing!

binuacs
20 - Arcturus

@khuebsch5 Similar to @DavidP  suggestion

binuacs_0-1648882860762.png

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

37FE513A-3AC7-4AFD-AFC6-9F9B8CAF9D13.jpeg

Alteryx ACE & Top Community Contributor

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

Whoops, forgot to come back and respond. This was perfect! I knew there was an outside-the-box solution I wasn't thinking of lol

Labels