I’m trying to create a conditional column that groups hospital shifts into three groupings in PowerQuery:
- 8am-3pm
- 3pm-113opm
- 1130pm-8am
The issue i’m having is for the hours between 1130pm and 8am. I have a separate column for TIME displayed as hh:mm:00
Here is the formula in powerquery:
= Table.AddColumn(#”Changed Type”, “Shift Grouping”, each
if [Arrival Time] >= #time(8, 1, 0) and [Arrival Time] <= #time(15, 0, 0) then “8a-3p”
else if [Arrival Time] >= #time(15, 0, 0) and [Arrival Time] <= #time(23, 30, 0) then “3p-1130p”
else if [Arrival Time] >= #time(23, 31, 0) and [Arrival Time] <= #time(8, 0, 0) then “1130p-8a” else “None”)