Free Trial

Alteryx Designer Desktop Discussions

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

Multi Row Subtraction/Addition

hemant86
11 - Bolide

HI Team,

I have the below requirement.

 

Input:

row no.EMP IDCodeAB
1123L19 
2123L30 
3123L32 
4123L37 
5123D14 
6123D24 
7123D37 

 

The Column B calculation should be done grouped by EMP ID & Code. Wondering if this can be achieved through multirow tool. Appreciate any help around this.

 

Required Output:

row no.EMP IDCodeAB  
1123L1919 B1=A1
2123L3011 B2=A2-A1
3123L322 B3=A3-(A2+A1)
4123L375 B4=A4-(A3+A2+A1)
5123D1414 B6=A6
6123D2410 B7=A7-A6
7123D3713 B8=A8-(A7+A6)
8 REPLIES 8
Raj
16 - Nebula

@hemant86 
find the workflow

attached

mark done if solved.

Qiu
21 - Polaris
21 - Polaris

@hemant86 
Your formula is not consistent with your value of B.

Maybe?

B3=A3-(B2+B1)

hemant86
11 - Bolide

HI @Qiu Apologies for the typo. Thanks for highlighting . Please find the updated output below.

 

 EMP IDCodeAB  
1123L1919 B1=A1
2123L3011 B2=A2-A1
3123L322 B3=A3-(B2+B1)
4123L375 B4=A4-(B3+B2+B1)
5123D1414 B5=A5
6123D2410 B6=A6-A5
7123D3713 B7=A7-(B6+B5)
Raj
16 - Nebula

@hemant86 
you can refer the solution attached
i guess that solves the problem.

hemant86
11 - Bolide

Thanks @Raj I was under an impression that the multi row formula you used will minus only the immediate previous row. Appreciate if you could share some insight on how it is taking sum of all previous rows and then doing a minus. Thanks again for the solution. 

Raj
16 - Nebula

@hemant86 Just used the basic math's to fulfill your requirement but 
to answer your question 
we can change this and this should work for multiple rows as well

hope this helps.

hemant86
11 - Bolide

@Raj If I'm getting your point correct, the number of rows for each employee in my data is not fixed. Keeps varying. 

Raj
16 - Nebula

@hemant86 
no this is not restricted to  number of rows.
this is dynamic and will work for any number of rows.

Labels
Top Solution Authors