We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

DateDiff of Row2 "From Date" to Row1 "To Date" when IDs Match

cpbrehmer
7 - Meteor

Hi Everyone,

Trying to figure out how to use the Formula tool to find every record where a Date Diff results in a value greater than 1. The challenge I am having is I am not sure how to get the formula to work by doing the Date Diff on Row2 to Row1

 

IDRecordFrom DateTo Date
1234112/31/20223/31/2023
123424/1/20236/30/2023
123438/15/2023null
567816/15/20237/25/2023
567828/4/2023null

 

I would like to do the Date Diff on Record 2 to Record 1 or Record 3 to Record 2, when the IDs match and get the results in Days.

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@cpbrehmer 
It is not clear to me that how you want to calculate the Date Diff, it is between From Date and To Date? Or The "To Date" between Row 2 and Row 1 or other case?

I assume The "To Date" between Row 2 and Row 1 and we can use the MultiRow Formula tool as below.

0422-cpbrehmer.png

cpbrehmer
7 - Meteor

@Qiu 
My apologies for not being clearer in the original question. The ask is to calculate the Date Diff between the From Date of Row 2 and the To Date of Row 1. A valid data condition is for the From Date of Row 2 to be only 1 day after the To Date of Row 1. Anything larger than 1 day means I have a gap that needs to be corrected.

cpbrehmer
7 - Meteor

@Qiu 

 

I think your solution works even though I wasn't clear in my original question. By making sure my records are ordered properly, I was able to use the Multi-Row Formula tool with this formula:

DateTimeDiff([From Date],[Row-1:To Date],"Days")

 

This appears to give me what I was looking for.

 

Thanks!

Qiu
21 - Polaris
21 - Polaris

@cpbrehmer 
Glad it gets sorted out. 😁

Labels
Top Solution Authors