Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

New field based on condition

Yuri24
8 - Asteroid

Hello,

 

I have a question on selecting top N rows for a data set. I understand I can use TOP N rows from Sample tile to select number of rows I want but what I am looking for is something dynamic. 

Here is the sample data set. Data has been grouped by the field Number and ranked accordingly. However to each group of unique "Number" I need to assign a new field half rows as 0 and half rows as 1. If the number of rows is N and for a group of N is even I need First N/2 rows as 1 and remaining as 0, however if N is odd then first N/2+1 rows is 1 and remaining 0. 

NameNumber Rank
John12345678901
Jane12345678902
John12345678903
Jane12345678904
John12345678905
Jane12345678906
Shawn23456789011
Shane23456789012
Shawn23456789013
Shane23456789014
Shawn23456789015
Shane23456789016
Shawn23456789017
Shane23456789018
Shawn23456789019
Jorge34567891011
Lu34567891012

From the sample data set above I will need:

NameNumber RankDecision
John123456789011
Jane123456789021
John123456789031
Jane123456789040
John123456789050
Jane123456789060
Shawn234567890111
Shane234567890121
Shawn234567890131
Shane234567890141
Shawn234567890151
Shane234567890160
Shawn234567890170
Shane234567890180
Shawn234567890190
Jorge345678910111
Lu345678910120

 Is this possible?

 

Thanks in advance.

1 REPLY 1
geraldo
13 - Pulsar

@Yuri24 

 

An workflow example 

 

rankx.JPG

Labels
Top Solution Authors