community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Apply formula for N rows

Highlighted
Meteor

Hi,

I am trying to replicate a logic into Alteryx, need help!

Logic:

If [Col B] = "Yes" ; then the preceding and succeeding 2 rows (also the corresponding row) of [Col C] = Value of [Col A]

Capture.PNG

It might be easy for 2 rows, What if i have to replicate it for 300 rows?

Alteryx Partner

A multi-row formula would do that for you :)

 

It might be easiest to create 5 formulas, being :

 

Row+2

Row+1

Row

Row-1

Row-2

 

Can you supply some dummy data as CSV or XLS and I can write an example workflow for you ?

Quasar

@cmcclellanis correct, a Multi-Row formula is the way to go. See attached and below for setup.

 

Formula =

 

IIF(
[Row-2:Col B]="Yes" ||
[Row-1:Col B]="Yes" ||
[Col B]="Yes" ||
[Row+1:Col B]="Yes" ||
[Row+2:Col B]="Yes",[Col A],Null())

 

2018-12-09_17-03-07.png

Alteryx Certified Partner
Alteryx Certified Partner
Great solutions provided above but I don't think they are particularly dynamic for say 300 rows as you mention.

I would probably do something with a record ID, generate rows, join and filter but I won't be able to look at this properly until the evening, so if anyone fancies a crack at making the solutions above more dynamic for a large number of rows I'm sure that w pould be appreciated.

Ben
Alteryx
Alteryx

I was curious when I first saw this question about solving it using Generate Rows... and I put the attached together, but never posted it as I think the Multi-Row is probably better. But posting it now that it's been mentioned anyhow...

Labels