1

Each row needs to be paired up with the one before it therefore I need a new column that looks like the following.

flag
1
1
2
2
3
3
4
4
5
5
.
.
.
and so on 
craig3656
  • 41
  • 4
  • Add a RecordID column named "flag"... it will be 1,2,3 4,5 etc... send that into a formula setting flag to `CEIL([flag]/2)` ... it will now be 1,1,2,2,3,3,etc... – johnjps111 Jun 11 '20 at 20:07

1 Answers1

0

You can solve this a number of ways with Alteryx. I chose to use one tool, the Multi-Row Formula tool, to make an elegant solution.

  1. Add the Multi-Row Formula tool.
  2. Use the default "Create a New Field" option and name the field "flag".
  3. Choose 2 as the "Num Rows".
  4. Choose "NULL" as the "Values for Rows that don't Exist".
  5. For the expression, paste the following:
IF ISNULL([Row-1:flag])
THEN 1
ELSEIF [Row-1:flag] == [Row-2:flag]
THEN [Row-1:flag] + 1
ELSE [Row-1:flag]
ENDIF

This will create the flag for you by paring the first and second rows, third and fourth, and so on.

As a reference, see my page in the Alteryx community. I am a certified partner. Alteryx Reference enter image description here