Forum Discussion
kattlees
9 years agoPost Patron
Calculate difference between two times
I know there has been some other posts about this, but I think mine is a little different. I have two columns SCHTM is the time a surgery is supposed to start SurgTime is the time it actually s...
- 9 years ago
Hi kattlees,
Based on my test, the formula below should work in your scenario. It will return a positive number when starts late, and return negative number when starts early. :smileyhappy:
TimeDiff = IF ( patientinfo[SurgTime] <= patientinfo[SCHTM], - DATEDIFF ( patientinfo[SurgTime], patientinfo[SCHTM], MINUTE ), DATEDIFF ( patientinfo[SCHTM], patientinfo[SurgTime], MINUTE ) )Regards
v-ljerr-msft
9 years agoMicrosoft Employee
Hi kattlees,
Based on my test, the formula below should work in your scenario. It will return a positive number when starts late, and return negative number when starts early. :smileyhappy:
TimeDiff =
IF (
patientinfo[SurgTime] <= patientinfo[SCHTM],
- DATEDIFF ( patientinfo[SurgTime], patientinfo[SCHTM], MINUTE ),
DATEDIFF ( patientinfo[SCHTM], patientinfo[SurgTime], MINUTE )
)
Regards