Forum Discussion

spandy34's avatar
spandy34
Responsive Resident
3 years ago
Solved

Calculating time Midnight

I have the table below.  I have a Plannned Entry Time and a Planned Exist Time and a Planned Duration which are all Time fields.  I have used the following formula for the Planned Duration Column

Planned Duration = [PlannedExitTime]-[PlannedEntryTime].  It works okay until like the example the Planned Entry TIme is 23:45:00 and then the Planned Exit Time is Midnight.  The Planned Duration states 23:45:00 instead of 00:15:00
 
Can someone help with the formula in the Planned Duration Column to resolve this please.

amitchandak Greg_Deckler 

 

 

  • spandy34's avatar
    spandy34
    3 years ago

    THis has solved it - thank you so much for your help

    Planned Duration =
      IF(
        [PlannedExitTime] = TIME(0,0,0),
       (TIME(23,59,59)- 'Procurement_Main_Data'[PlannedEntryTime])+TIME(0,0,1),
       [PlannedExitTime] - [PlannedEntryTime]
      )

7 Replies