Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Good Morning All,
I think I'm overcomplicating here but I'm struggling to create a calculated column to identify "Work Shift" by looking at the hours of the day.
I have my times split into a single column.
I need one column that looks at the times and displays what shift that falls under.
0600AM to 0200PM = "Days"
0201PM to 1000PM = "Afternoons"
1001PM to 0559AM = "Midnights"
Any help is greatly appreciated.
Nick
Solved! Go to Solution.
Hi @NekoGTz ,
The basic syntax for your new column will be like this:
if [ReceivedTime.2] >= #time(06, 00, 00) and [ReceivedTime.2] < #time(14, 00, 00) then "Days"
else ...etc
Pete
Proud to be a Datanaut!
Hi @NekoGTz ,
The basic syntax for your new column will be like this:
if [ReceivedTime.2] >= #time(06, 00, 00) and [ReceivedTime.2] < #time(14, 00, 00) then "Days"
else ...etc
Pete
Proud to be a Datanaut!
Pete - Can't thank you enough! I've been scratching my head for days with incorrect time format.
Final statement is: (and works perfectly)
if [ReceivedTime.2] >= #time(06, 00, 00) and [ReceivedTime.2] < #time(14, 00, 00) then "Days" else if [ReceivedTime.2] >= #time(14, 01, 00) and [ReceivedTime.2] < #time(22, 00, 00) then "Afternoons" else "Midnights"
Hi @NekoGTz ,
Glad this got you sorted.
You just need to adjust your second line to the following, otherwise you'll miss any times between 14:00:00 and 14:00:59 :
[ReceivedTime.2] >= #time(14, 00, 00) // changed to 14:00:00
Pete
Proud to be a Datanaut!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |