Alteryx Designer Desktop Discussions

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

Need to create a field that increments by 3's or 4th

jdelaguila
8 - Asteroid

I have a file i receive, sometime with less than 100 records and sometimes over 10,000 records. 

 

I need to create a field that increments by 3's  or 4th's all the way down the file.

 

So if i have 100 fields i need a field created that goes 1,2,3,1,2,3,1,2,3 all the way down the file. Sometimes 1,2,3,4,1,2,3,4 etc. 

 

I tried using a Generate Row tool - but can't get it to increment correctly. 

 

Any clues on what tool i could use to do this? I attached my failed workflow. 

3 REPLIES 3
thiago_belarmino
8 - Asteroid

Try this.

 

In multi-row formula

For 1,2,3:

IF [Row-1:New Field] = 1 THEN 2
ELSEIF [Row-1:New Field] = 2 THEN 3
ELSE 1
ENDIF

 

For 1,2,3,4:

IF [Row-1:New Field] = 1 THEN 2
ELSEIF [Row-1:New Field] = 2 THEN 3
ELSEIF [Row-1:New Field] = 3 THEN 4
ELSE 1
ENDIF

 

I hope helped you.

ncrlelia
11 - Bolide

Hi @jdelaguila,

 

I would also use Multi-Row formula, but with the below formula (highlighted in yellow).

The number circled in red is the increment value you wish to have. For example, change '3' to '4' when you need increments by 4. 

ncrlelia_1-1628557328194.png

 

Hope this helps.

 

Cheers, 

Lelia

jdelaguila
8 - Asteroid

That was it!! Thanks soo much!  

 

Javier

Labels