Alteryx Designer Desktop Discussions

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

How to increment row number starting from Zero

thd-data-analyst
7 - Meteor

Hello,

 

I need to assign row number to groups of data in a table. My table is like this:

 

ProductCategoryAttributeValue
100123Cat1Att1Blue
100123Cat1Att1Green
100123Cat1Att1Yellow
100123Cat1Att1Orange
100127Cat2Att1Power Wash
100127Cat2Att1Oil Change
100127Cat2Att1Fluids Top-up
100130Cat1Att2Stainless Steel Drum
100130Cat1Att2Programable Timer
100130Cat1Att2Fuzzy Logic
100130Cat1Att2Auto Shut-off
100130Cat1Att2Water Saving
100135Cat2Att1Power Wash
100135Cat2Att1Oil Change

 

I need a new Position column that starts from zero and increments by 1 for each item in the group. I was able to add the increments using a Multi-row formula, but I don't know to start the numbering from zero. Can anyone suggest how I can do that?

 

I have attached my workflow to the question.

12 REPLIES 12
TheOC
15 - Aurora
15 - Aurora

hi @thd-data-analyst 

You can achieve this with the recordID tool!

TheOC_0-1602699688119.png



TheOC_1-1602699696729.png



I have attached a workflow with this included.

Let me know if i can help any further


Bulien
thd-data-analyst
7 - Meteor

Thank you @TheOC the recordid has applied the row number to the whole table starting with zero. I need to the row number to be applied to the groups of data. For example, if you run my original workflow you will see that it assigns the numbers starting with 1 for separate groups of rows where the only thing that changes is the Value column. I need the row numbers to be assigned to the groups, but should start from zero instead of 1.

atcodedog05
22 - Nova
22 - Nova

Hi @thd-data-analyst 

 

I have done a minor change in your workflow to start from zero

 

I have added a formula tool and done 

[Position]-1

Output:

atcodedog05_0-1602699969170.png

 

It not possible that easily to directly integrate it in the Multi-row formula tool itself

 

Hope this helps 🙂

 

If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

thd-data-analyst
7 - Meteor

@atcodedog05, thank you, this works.

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @thd-data-analyst 

 

Cheers and Happy Analysing 😀

TheOC
15 - Aurora
15 - Aurora

hi @thd-data-analyst 

Ah yes! Sorry my silly mistake, I didn't see that part of your multi-row formula. I believe @McEleavey has been working on a tool that allows for grouping by field on the record id tool, which sounds perfect for this case!

Alternatively, I would have done something like what @atcodedog05 has done



Bulien
thd-data-analyst
7 - Meteor

Thank you @TheOC , the tool you mentioned does sound like the perfect solution. How can I access the same?

atcodedog05
22 - Nova
22 - Nova

Hi @TheOC 

 

Tile tool Tile sequence gives the similar effect of Record ID on grouby. It can be used alternatively.

TheOC
15 - Aurora
15 - Aurora

Hi @thd-data-analyst !

I believe this tool is still being worked on, but your best bet would be to message/follow him directly, whether on these forums or on his twitter (where i saw the tool mentioned): https://twitter.com/ChrisMacBP/status/1315016212582203392

Alternatively, as @atcodedog05 has said, the tile tool can be used for this, and heres an example


Bulien
Labels