Alteryx Designer Desktop Discussions

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

Iterative subtraction

nazuk
8 - Asteroid

Hello All,

 

 

Need your help for the following scenario

 

SharesNet amountKeyDifference
1000456A2
20004566A
3400786800A
245008700B3
2000767800B
56007869800B
67007867800B
78008700

B

 

 

 

So here i have to start subtracting the difference  Amount to all net amount such that it start assigning 0.01 from first net amount then the next group by key till whole difference is allocated to net amount.

 

I have already this in mind that i first calculate 

 

Difference/0.01*no of rows per key, and then start assigning that amount.

 

But how to do it that suppose there are 6 rows only and difference amount is say 0.02, then it should only allocate to first two net amount.

 

Can anyone help ?

3 REPLIES 3
fmvizcaino
17 - Castor
17 - Castor

Hi @nazuk ,

 

Would you be able to show the calculation for key A? It is not clear to me how this works.

 

Best,

Fernando V.

nazuk
8 - Asteroid

Hi , so just take the below example

SharesNet amountKeyDifference1st roundNet amount2nd roundNet amount
1000456A0.05456+0.01456.01456.01+0.1456.02
20004566A4566+0.014566.014566.01+0.14566.02
3400786800A786800+0.01786800.01  

 

So here the difference amount is 0.05, so i have to start allocating this difference amount untill it is allocated to all. So i always have to start allocating to the small holding first 0.01 and later on, after one iteration we need to calculated how much is allocated and remaining need to do in next one

 output should be:

 

SharesNet amountKeyDifference
1000456.02A0.05
20004566.02A
3400786800.01A
fmvizcaino
17 - Castor
17 - Castor

Hi @nazuk ,

 

I didn't follow your step by step  to create the logic because it would make the workflow more complex since we would need to create an iterative macro.. so I adapted the logic to make it easier.

 

fmvizcaino_0-1590755015748.png

 

Best,

Fernando Vizcaino

 

 

Labels