#"Added -VTO-adjust punch in" = Table.AddColumn(#"Expanded CSSM - schedule VTO", "VTO-adjust punch in", each if [#"Punch-In-vto"] <> null then (if [#"Punch-In"] < [#"Punch-Out-vto"] and [#"Punch-Out"] > [#"Punch-In-vto"] then(
if [#"Punch-In"] >= [#"Punch-In-vto"] then [#"Punch-In-vto"] else [#"Punch-In"]
)else [#"Punch-In"])
else [#"Punch-In"]),
#"Added -VTO-adjust punch out" = Table.AddColumn(#"Added -VTO-adjust punch in", "VTO-adjust punch out", each if [#"Punch-Out-vto"] <> null then (if [#"Punch-In"] < [#"Punch-Out-vto"] and [#"Punch-Out"] > [#"Punch-In-vto"] then(
if [#"Punch-Out"] <= [#"Punch-Out-vto"] then [#"Punch-Out-vto"] else [#"Punch-Out"]
)else [#"Punch-Out"])
else [#"Punch-Out"]),
Solved! Go to Solution.
HI @PNC97 ,
If you could post some data and what you are trying to achieve that would be easier for us to help you.
Thanks,
M
Hi @PNC97 ,
Agree with @mceleavey that would be easier if some data was available. However, note that nested if statements in Alteryx work a little different:
If [Logical Test 1] then [Value Test 1 True]
Elseif [Logical Test 2] then [Value Test 2 True]
Elseif [Logical Test 3] then [Value Test 3 True]
.......
Else [Value if False] Endif
Hope that helps.
Erin
Input is below table
Employee ID | Event Date | Punch-In | Punch-Out | Punch-In-vto | Punch-Out-vto |
1 | 4/21/2021 | 14.11666667 | 15.01666667 | 8 | 11 |
2 | 4/5/2021 | 10.53333333 | 12.4 | 9 | 9.5 |
3 | 4/5/2021 | 13.38333333 | 18 | 9 | 9.5 |
4 | 4/5/2021 | 9.016666667 | 9.51666667 | 9 | 16 |
5 | 4/5/2021 | 9.98333333 | 12.55 | 9 | 16 |
6 | 4/5/2021 | 13.51666667 | 16.73333333 | 9 | 16 |
7 | 4/6/2021 | 8.083333333 | 9.033333333 | 9 | 9.5 |
8 | 4/6/2021 | 9.73333333 | 11.58333333 | 9 | 9.5 |
9 | 4/6/2021 | 14.01666667 | 15.66666667 | 9 | 9.5 |
Output expected
Employee ID | Event Date | Punch-In | Punch-Out | Punch-In-vto | Punch-Out-vto | VTO-adjust punch in | VTO-adjust punch out |
1 | 4/21/2021 | 14.11667 | 15.0166667 | 8 | 11 | 14.11666667 | 15.01666667 |
2 | 4/5/2021 | 10.53333 | 12.4 | 9 | 9.5 | 10.53333333 | 12.4 |
3 | 4/5/2021 | 13.38333 | 18 | 9 | 9.5 | 13.38333333 | 18 |
4 | 4/5/2021 | 9.016667 | 9.51666667 | 9 | 16 | 9 | 16 |
5 | 4/5/2021 | 9.983333 | 12.55 | 9 | 16 | 9 | 16 |
6 | 4/5/2021 | 13.51667 | 16.7333333 | 9 | 16 | 9 | 16.73333333 |
7 | 4/6/2021 | 8.083333 | 9.03333333 | 9 | 9.5 | 8.083333333 | 9.5 |
8 | 4/6/2021 | 9.733333 | 11.5833333 | 9 | 9.5 | 9.73333333 | 11.58333333 |
9 | 4/6/2021 | 14.01667 | 15.6666667 | 9 | 9.5 | 14.01666667 | 15.66666667 |
I tried using this as a formula,
But, the output which I got is incorrect
For VTO-adjust punch in: 1st format
IF [Punch-In-vto] != Null() THEN [Punch-In] ELSEIF [Punch-In] < [Punch-Out-vto] && [Punch-Out] > [Punch-In-vto] THEN [Punch-In] ELSEIF [Punch-In] >= [Punch-In-vto] THEN [Punch-In-vto] ELSE [Punch-In] ENDIF
And For VTO-adjust punch out: 2nd format
IF [Punch-Out-vto] != Null() AND [Punch-In] < [Punch-Out-vto] AND [Punch-Out] > [Punch-In-vto] AND [Punch-Out] <= [Punch-Out-vto] THEN [Punch-Out-vto] ELSE [Punch-Out] ENDIF
I have given Input and output expected
Thanks in advance.
With the below formulas the output which i got is incorrect
@PNC97
I can reproduce these two colummns by just copying your formula with some data cleansing.
VTO-adjust punch in | VTO-adjust punch out |