Forum Discussion

kattlees's avatar
kattlees
Post Patron
9 years ago
Solved

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...
  • v-ljerr-msft's avatar
    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