Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Multi Row Subtraction

Anudeep_Yalamuru
8 - Asteroid

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

3 REPLIES 3
Anudeep_Yalamuru
8 - Asteroid
POP nowPOP needed
1444614446
1111111111
117034105923
390084273050
800354410270

 

required output

DataNath
17 - Castor
17 - Castor

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

 

ConditionalMultirow.png

Anudeep_Yalamuru
8 - Asteroid

 Thanks @DataNath It works.

Labels
Top Solution Authors