Alteryx Designer Desktop Discussions

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

Formula to count rows using a key field

nihou
8 - Asteroid

I am trying to use the formula tool to add a column/formula to count rows based on a key field.

 

Example using Restaurant Number as my key field.

 

Restaurant Number

 

123

456

456

456

789

789

 

New Column 

0001

0001

0002

0003

0001

0002

5 REPLIES 5
pedrodrfaria
13 - Pulsar

Hi, @nihou 

 

You can do a logic with the formula and the running total. Please see attached.

pedrodrfaria_0-1609892825966.png

Or you could also do a logic with the multirow. I prefer the one above because is super simple and you can just remove the additional column with a select tool.

 

Please let me know if you need any additional help with this question.

 

Pedro.

 

 

nihou
8 - Asteroid

Yes, thank you.  How do I get it to count with an output of 0001 instead of 1, 0002 instead of 2, etc?

 

Thank you!

pedrodrfaria
13 - Pulsar

We can use a Padleft function in the formula tool

 

pedrodrfaria_0-1609893607012.png

 

Please @nihou assign the answer as the solution for your post if we have answered your question. It really helps us.

 

Pedro.

 

nihou
8 - Asteroid

Test File with Padleft

kenkie
6 - Meteoroid

runtot and multirow

Labels