Forum Discussion
Create shift column depending on the time
Could someone help, please? I am creating a new column that I want to display shift "1" "2" or "3" depending on the time of my production order. I tried to use
oops, forgot to add return in the code
try this
Measure = Var _A= time(6,20,0) Var _B = time(14,20,00) Var _C = time(22,20,00) Var _D = time(06,19,59) return IF ( HOUR ( [Hora PO] ) >= _A && HOUR ( [Hora PO] ) <= _B, 1, IF ( HOUR ( [Hora PO] ) > _B && HOUR ( [Hora PO] ) <= _C, 2, 3))If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
5 Replies
- VahidDMSuper User
Hi pagliaci
Use variables:
Measure = Var _A= time(6,20,0) Var _B = time(14,20,00) Var _C = time(22,20,00) Var _D = time(06,19,59) IF ( HOUR ( [Hora PO] ) >= _A && HOUR ( [Hora PO] ) <= _B, 1, IF ( HOUR ( [Hora PO] ) > _B && HOUR ( [Hora PO] ) <= _C, 2, 3))If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
- pagliaciFrequent Visitor
Thank you so much!
- VahidDMSuper User
oops, forgot to add return in the code
try this
Measure = Var _A= time(6,20,0) Var _B = time(14,20,00) Var _C = time(22,20,00) Var _D = time(06,19,59) return IF ( HOUR ( [Hora PO] ) >= _A && HOUR ( [Hora PO] ) <= _B, 1, IF ( HOUR ( [Hora PO] ) > _B && HOUR ( [Hora PO] ) <= _C, 2, 3))If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
- pagliaciFrequent Visitor
It keeps getting the same error, the last column is always returning 3, even though it is morning time (1st column)..