Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Matching to the largest number smaller than X

$
0
0

Hi. I have a column of consecutive dates:

 

Data set 1

 

Date
Jan 1
Jan 2
Jan 3
...
Dec 31

 

I have another data set where each row is an "activity", and the columns are "activity description" and "date"

 

Data set 2

Desc.Date
Activity 1Jan 1
Activity 2Jan 3
Activity 3Apr 23
Activity 4Oct 14

 

What I want to do is create a new dataset, which is basically the same as "Data set 1" (i.e. the first column will be every date from Jan 1 to Dec 31), but the second column will be whatever the last activity to occur was (i.e. for a given row/date, what is the largest date in "Data set 2" that is less than the date in the new row). So, as an example, it would look something like this:

 

Data set 3

DateLast activity
Jan 1Activity 1
Jan 2Activity 1
Jan 3Activity 2
Jan 4Activity 2
Jan 5Activity 2
...Activity 2
Apr 21Activity 2
Apr 22Activity 2
Apr 23Activity 3
Apr 24Activity 3

 

Is there a simple way to do this type of matching in Alteryx? 

 

Thanks in advance,
Dan


Viewing all articles
Browse latest Browse all 4999

Trending Articles