Recursive Indexing Using Multi-Row Tool in Alteryx

Here is just a very quick tip on recursive Indexing by using a multi-row tool.

Let's say you have some data which measure order is "Name>Gender>Age>Name>Gender>...". In order to do some pivoting you need to identify what the measures are. So we need to index the cells first, and then rename the index and pivoting the data later on.

By applying the multi-row tool, with a formula:
  if [Row-1:ID]==3 or [Row-1:ID]==0 then 1 else [Row-1:ID]+1 endif

 where you can change the 3 to the maximum number of each recursion you want.

In this example, the formula means that when the previous row is 3 then count back to 1. Because the viod row before 1th row (0th row) is default as 0, the 1st row will also start at 1. For other row, just simply add 1 to the previous row to do the counting.

If you like it, feel free to check out my other posts and connect with me on Linkedin - learn and improve together!
https://www.thedataschool.co.uk/blog/stanley-chan

https://www.linkedin.com/in/staneykinnok-chan/

Author:
Stanley Chan
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab