Alteryx Designer Desktop Discussions

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

Identify sequential numbers across different rows

Data_Alter
8 - Asteroid

I have this data where I want to identify all the sequential numbers across different rows and give them a unique reference

 

For eg. the few lines from the data I have

 

IDAmount
2515669429
251567086
2515671-515
2515894170
251589534
2515896-204
251590880
251590916
2515910-96
2515916150
251591732
2515918-192
25159195
25159205
2515146-5
25151475

 

 

Desired Result

 

IDAmountUnique Reference
25156694291
2515670861
2515671-5151
25158941702
2515895342
2515896-2042
2515908803
2515909163
2515910-963
25159161504
2515917324
2515918-1924
251591954
251592054
2515146-55
251514755

 

Please can someone help !!

6 REPLIES 6
Emil_Kos
17 - Castor
17 - Castor

Hi,

 

In order to achieve it you need to use multi row formula tool.

 

 

I have prepared a workflow for you:

 

Emil_Kos_1-1608551852541.png

The formula is:

 

IIF([Row-1:ID]+1=[ID],[Row-1:New Field] , [Row-1:New Field]+1)

 

The output:

 

Emil_Kos_2-1608551884692.png

 

 

Please mark my post as a solution if this is helpful for you!

 

Data_Alter
8 - Asteroid

Thanks @Emil_Kos 

 

That is what I looking to do but it doesn't give me the result I wanted for the full data I have.

 

Is it possible to do this on the Amount column ? For e.g a unique reference for the rows until when the Amount column nets to zero.

 

For e.g in the data below first three rows net to zero , then next eleven net to zero and so on.

 

Amount
-253
-51
304
480
-2880
0
-2420
0
-29
2400
1210
1210
20
9
4
1
-5
362
72
-434

 

Desired result 

 

AmountUnique reference
-2531
-511
3041
4802
-28802
02
-24202
02
-292
24002
12102
12102
202
92
43
13
-53
3624
724
-4344

 

Emil_Kos
17 - Castor
17 - Castor

Hi @Data_Alter,

 

Ruining total is very helpful here.

 

Emil_Kos_0-1608554401143.png

With combination of mutlirow formula tool I could achieve the result.

 

There is one small difference with the output as the last position should be in the 5th group. At least that is my understanding. 

 

 

Data_Alter
8 - Asteroid

Thanks @Emil_Kos 

 

That is brilliant. It is very close.

 

The unique reference changes from the row where "RunTot_Amount" becomes 0. Whereas I want it be changed after that .

 

Please see the "result I want" colum. IS there a quick way to fix this ?

 

AmountRunTot_AmountNew FieldResult I want
-253-25311
-51-30411
304021
48048022
-2880-240022
0-240022
-2420-482022
0-482022
-29-484922
2400-244922
1210-123922
1210-2922
20-922
9032
4433
1533
-5043
36236244
7243444
-434054
Emil_Kos
17 - Castor
17 - Castor

Hi,

 

I am blind that I have missed it.

 

Emil_Kos_0-1608556222418.png

I just changed the point of reference. Now I am looking for the net amount equals to zero in the previous line instead of the current line. 

 

 

Data_Alter
8 - Asteroid

Thanks @Emil_Kos for your help.

Labels