Hi All,
I need to use a multi-row subtraction but its a conditional one. I'm stuck on how to use it.
You can see in the dataset that if DT is 1 or 5, POP or HH fields should be unchanged.
But if its 10/15/20 then POP = POP (10) - POP (5). Similarly for 15 and 20.
I know how to do it in excel but trying to bring it into Alteryx. Pleas provide your feedbacks
DT HH POP
1 5043 14446
5 3787 11111
10 40607 117034
15 139674 390084
20 288931 800354
Solved! Go to Solution.
POP now | POP needed |
14446 | 14446 |
11111 | 11111 |
117034 | 105923 |
390084 | 273050 |
800354 | 410270 |
required output
Hey @Anudeep_Yalamuru, you ought to be able to achieve that with the following expression:
IF [DT] IN (10,15,20) THEN [POP]-[Row-1:POP] ELSE [POP] ENDIF
Thanks @DataNath It works.