cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Bearcat
Level I

Calculating days between similar or matching rows/events?

Hi everyone, I have a list of events and their dates. I want to calculate the number of days since a matching event happened.

 

For example, I have a list of patients visiting a doctor. I have the first two columns, Name and Date of Visit, but I would like to know how to calculate the third column, Days Since Last Visit. This would return only the number of days since Dave's most recent visit. Any guidance, especially in formula creation, would be appreciated.

 

NameDate of VisitDays Since Last Visit
John6/1/2018.
Dave6/14/2018.
Mike6/17/2018.
Mike6/21/20184
Dave7/1/201816
John7/3/201832
1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: Calculating days between similar or matching rows/events?

Bearcat, there are likely multiple methods to do this, but here is my recommendation. Create a column named Date of Last Visit and then find the difference. To get the date of the last visit, I attached a script to the data table.

 

So add new records, run the table script and the table is updated. By keeping the Date of Last Visit, it is easier to verify results.

Note to get days find the difference in the dates and divide by 24*60*60, the number of seconds in a day.

 

I hope this helps.

View solution in original post

2 REPLIES 2
gzmorgan0
Super User (Alumni)

Re: Calculating days between similar or matching rows/events?

Bearcat, there are likely multiple methods to do this, but here is my recommendation. Create a column named Date of Last Visit and then find the difference. To get the date of the last visit, I attached a script to the data table.

 

So add new records, run the table script and the table is updated. By keeping the Date of Last Visit, it is easier to verify results.

Note to get days find the difference in the dates and divide by 24*60*60, the number of seconds in a day.

 

I hope this helps.

Bearcat
Level I

Re: Calculating days between similar or matching rows/events?

This is perfect, exactly what I needed. Thanks!