Alteryx Designer Desktop Discussions

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

Filter data to returned most recent date based on particular column

arsenal88
6 - Meteoroid

Hi I'm new to Alteryx, and wonder how can I select only those based on below scenario? Basically it based on ID and LastUpdate.

 

records:

IDNameLastUpdate
89Ken2016-12-12 08:34:01
89JIM2016-12-12 08:31:55

 

Expected output

IDNameLastUpdate
89Ken2016-12-12 08:34:01
9 REPLIES 9
NickJ
Alteryx Alumni (Retired)

Hi,

 

Welcome to Alteryx!

 

Just to confirm what you're looking for - you're looking to filter the data to return the most recent date found in the LastUpdate field, correct?

 

A really simple way to achieve this would be to add a Sort tool, sorting on LastUpdate - Descending. Add a Sample tool with First N Records (N=1) to retrieve the latest date. 

 

If that's not quite what you were after, please reply and add a little more detail?

 

Cheers!
Nick

Nick Jewell | datacurious.ai
arsenal88
6 - Meteoroid
I hv multiple rows with different ID. If same ID then i want to extract those hv lasted date.



Sent from my Samsung Galaxy smartphone.
NickJ
Alteryx Alumni (Retired)

Hi,

 

Are you able to add a few more rows of sample data to explain your use-case?

 

I've added a few below:

 

IDNameLastUpdate
89Ken2016-12-12 08:34:01
89JIM2016-12-12 08:31:55
90Nick2016-12-11 08:31:45
90Pete2016-12-11 09:31:55
91Barb2016-12-12 10:12:34
96Jon2016-12-31 23:45:12
99Carl2017-01-02 14:23:45

 

Are you looking for the LastUpdate value for each ID (and in the case where there's more than one row per ID, you want the latest LastUpdate value only)? 

 

If the above is correct, are you looking for:

 

 

IDNameLastUpdate
89Ken2016-12-12 08:34:01
90Pete2016-12-11 09:31:55
91Barb2016-12-12 10:12:34
96Jon2016-12-31 23:45:12
99Carl2017-01-02 14:23:45

 

Cheers,

Nick

Nick Jewell | datacurious.ai
arsenal88
6 - Meteoroid
Exactly



Sent from my Samsung Galaxy smartphone.
arsenal88
6 - Meteoroid
Exactly



Sent from my Samsung Galaxy smartphone.
NickJ
Alteryx Alumni (Retired)

Great - thanks for clarifying. 

 

In that case, it's the same workflow as above, but you now add a Group to the Sample tool (I've attached an updated workflow). You group by ID so that you get the Top 1 (per ID value). 

 

Let me know if that works for you?

 

Cheers,

Nick

Nick Jewell | datacurious.ai
arsenal88
6 - Meteoroid

Excellent. Thanks

JJH
7 - Meteor

Hi,

 

it seems your 2nd workflow is the same as the 1st one. 

If I were to change the table to look like the below, how would you pull 1 row of data per User where the 'Date' is most recent?

 

Data Table

 

UserLogin Dates
A2020-01-30
B2007-05-09
A2019-12-31
C2020-03-14
B2020-02-15

 

Required Output

UserLogin Dates
A2020-01-30
B2020-02-15
C2020-03-14

 

JJH
7 - Meteor

I seem to have figured it out..

Use 'Summarize' tool.

in the tool, group by 'User' & max of 'Date Login'.

Labels