Compare data on two rows

Here’s a short video explaining what I’m trying to do:

Here’s some explanation:

I’m doing analysis of how quickly nurses respond to call light buttons when a patient needs them. In the attached data I have the Room number, the date that the patient pressed the call light button, the Time Called (the time they pushed the button) and the Time Answered (the time the nurse responded and turned off the call light), and I have the Nurse (Nurse A, Nurse B). Sometimes a nurse turns off a call light but the patient turns it on again within a few minutes. I want to find cases where:

-On the same date
-For the same room
-A call light was turned off (Time answered)
-And then turned on again (Next “Time called” for that same room, on same date) within 5 minutes

And attached is my sample fileRepeat_Calls.xlsx (8.3 KB)

From the top if my head: you need a Sort node to make sure the table is sorted to first the room number, then the date, the the time. Then, within a Group Loop that loops over room number and date, use the Lag node to create a second time column. The use a Date&Time difference node to calculate the difference between the two columns. Then use Duration To Number node, and then a Row Filter.


I attached a workflow that does what you want. Please do not blame overworked nurses, appreciate their work, hire more of them and give them a raise!

I use the three columns that should match to create an artificial ID, I sort by that id and the Time Called and then use a rule to define what is a match

kn_example_nurses_call.knwf (60.0 KB)


Very cool solution. Thank you very much for taking the time to build it. And Yes! our company is building software to get nurses more help when they are busy taking care of patients. Thanks again.

1 Like

Thank you Aswin - that seems like a good way to approach the problem as well as the solution below.

1 Like