Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Finding First and Last Instance

sprimosch
6 - Meteoroid

I have a dataset that includes multiple lines per individual.  I want to only keep the earliest instance (by date) of each individual and the last instance (by date) of each individual and omit all other line.  What is the best way to do this?

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

There's a few ways you can approach this. In most cases, you'll first need to identify the records you want to keep, then filter. The most important thing to keep in mind is the format of your date field. If it is a string field then "3-11-2018" would come before "3-2-2018". I recommend converting to a date-type field first. 

 

See the attached example for 3 different ways to get only the first and last records for each user.

sprimosch
6 - Meteoroid

Thanks for the help.

Labels
Top Solution Authors