Free Trial

Alteryx Designer Desktop Discussions

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

Flag consecutive rows with same values

saachitalwar
8 - Asteroid

I wish to mark the first occurrence of a value as 1 and every consecutive occurrence as 0 so I remove the values containing 0 flag. I tried using the multi row formula tool but that didn't work.

 

if [row-1:Gross AUM] = [Gross AUM] else iif([row-1:Gross AUM]),1,0) endif

 

I have data in the form:

 

h1
123
123
123
123
123
123
456
456
456
456
456
456
456
456
789
789
789
789
789

 

and I wish to get it in the form:

 

h1
123
123
123
123
123
123
456
456
456
456
456
456
456
456
789
789
789
789
789
4 REPLIES 4
binuacs
21 - Polaris

@saachitalwar what is the expected output? 

saachitalwar
8 - Asteroid
h1count
1231
1230
1230
1230
1230
1230
4561
4560
4560
4560
4560
4560
4560
4560
7891
7890
7890
7890
7890

 

correction in the required output

 

DataNath
17 - Castor
17 - Castor

Hey @saachitalwar, if you're just wanting to mark the first occurrence and remove subsequent rows then you can group by the value itself and create an index within this partition. Then just filter for [Flag] = 1, like so:

 

FirstOccurence1.png

FirstOccurence2.png

 

However, if you have values that may repeat in future i.e. another block of 123, and you again want to capture the first occurrence, you'll need to do something close to what you were trying originally where you just mark a change in value with a flag and filter on that, like so:

 

FirstOccurence3.pngFirstOccurence4.png

 

Workflow attached for you to look through. Hope this helps!

saachitalwar
8 - Asteroid

this worked. thanks

Labels
Top Solution Authors