Это должно быть немного легче для чтения, и должно делать то, что вам нужно:
Ref_Time =
SWITCH (
TRUE (),
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:35:00 AM" ), "6:00:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:30:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:35:00 AM" )
), "5:30:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:25:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:30:00 AM" )
), "5:25:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:20:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:25:00 AM" )
), "5:20:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:15:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:20:00 AM" )
), "5:15:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:10:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:15:00 AM" )
), "5:10:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:05:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:10:00 AM" )
), "5:05:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "5:00:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:05:00 AM" )
), "5:00:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "4:55:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "5:00:00 AM" )
), "4:55:00 AM",
AND (
TIMEVALUE ( DataTable[endTime] ) >= TIMEVALUE ( "2:00:00 AM" ),
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "4:55:00 AM" )
), "2:00:00 AM",
TIMEVALUE ( DataTable[endTime] ) < TIMEVALUE ( "2:00:00 AM" ), "1:00:00 AM"
)