Hi,
Can you please help me? I am trying to create a unique set of numbers in Alteryx as illustrated below.
Current | Desired |
0 | 0 |
0 | 0 |
0 | 0 |
0 | 0 |
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
2 | 2 |
2 | 2 |
2 | 2 |
2 | 2 |
2 | 2 |
2 | 2 |
3 | 3 |
3 | 3 |
3 | 3 |
4 | 4 |
4 | 4 |
4 | 4 |
4 | 4 |
4 | 4 |
5 | 5 |
5 | 5 |
5 | 5 |
5 | 5 |
0 | 6 |
0 | 6 |
0 | 6 |
1 | 7 |
1 | 7 |
2 | 8 |
2 | 8 |
Solved! Go to Solution.
So assuming that the "Current" column is in the order you want it to be, and you're looking to just increment by 1 for every new number change, I think you could do this with a Multi-Row tool.
if [Current]=[Row-1:Current]
Then [Row-1:NewNumber]
Else [Row-1:NewNumber]+1
Endif
This formula would look to the row above and see if it was the same number. If it wasn't, it would increment the "NewNumber" by 1, otherwise it would just use the same NewNumber as above. If your data doesn't start at 0 in the current, you'll probably need to have another IF scenario for what to do for the first record of the data set... but otherwise, this will give you the answers you are looking for based on your sample data provided.
Hope that helps!!
Cheers!
NJ
Thanks so much Nicole! This worked perfectly! Cheers!