Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to Solution.
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!!
Thank you so much!
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!!
It keeps getting the same error, the last column is always returning 3, even though it is morning time (1st column)..
Sorry I forgot to remove HOUR in the code, please try this to add your column:
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 (
[Hora PO] >= _A
&& [Hora PO] <= _B,
1,
IF ( [Hora PO] > _B && [Hora PO] <= _C, 2, 3 )
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos🙏!!
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!!
User | Count |
---|---|
16 | |
13 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |