Forum Discussion
Anonymous
4 years agoNot applicable
Use time stamp to determine shift
Hello all, I have a column with a date and time field formated as: 1/19/2022 2:05:16 PM I need to calculate from this column whether it was Day Shift or Afternoon Shift. Day shift starts at 7...
- 4 years ago
Hi Anonymous
Try this code to add a new column:
DvA = Var _Time = TIMEVALUE(Tracking[Date/Tim]) Var _DN = WEEKDAY(Tracking[Date/Tim]) Var _MT = time(7,00,00) Var _AF = if(_DN=6,time(16,30,00),time(17,30,00)) return if(_Time>=_MT&&_Time<=_AF,"Day Shift","Afternoon Shift")output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
VahidDM
4 years agoSuper User
Hi Anonymous
Try this code to add a new column:
DvA =
Var _Time = TIMEVALUE(Tracking[Date/Tim])
Var _DN = WEEKDAY(Tracking[Date/Tim])
Var _MT = time(7,00,00)
Var _AF = if(_DN=6,time(16,30,00),time(17,30,00))
return
if(_Time>=_MT&&_Time<=_AF,"Day Shift","Afternoon Shift")
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
- Anonymous4 years agoNot applicable
Perfect! Thank you so much for this!