Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Multi Row look-up and flag

Caleb
7 - Meteor

Hello Everyone, 

 

I'm hoping someone can help me figure out how to create a Alteryx process that flags a row when certain conditions are met within a series of rows containing the same unique identifier. 

 

I created a small table below that shows the structure of my data. The table contains historical student enrollment. Each enrolled student has one row per year they were enrolled. Usually, a student's grade level increases by one as the years pass. However, in some cases, student's are retained (repeat a grade). I'm trying to figure out how to flag the repeated grade(s) for these students. 

 

School_YearStudentIDGrade_Historical
2012-20139999910
2013-20149999910
2014-20159999911
2012-2013111111
2013-2014111112
2014-2015111113

 

Thank you in advance!

 

Caleb

5 REPLIES 5
JoeM
Alteryx Alumni (Retired)

@Caleb - you were right on with the idea of using a multi-row formula. Attached a solution using your sample data.

(Disregard the dynamic rename as a part of the process  - I was just renaming the field from copying it over from your Community post)

 

Formula:

IF [Grade_Historical]=[Row-1:Grade_Historical] then 1 else 0 endif

AKA - if the row above representing the previous grade shows the exact same grade at the current record level, flag it. Note that it is important to have a sort process before the multi-field formula (year asc, grade asc) and to group by student in the multi-field formula.

 

Caleb
7 - Meteor

Thanks so much, Joe!

Caleb
7 - Meteor

Adding to this for anyone who intends to use this solution. 

 

JoeM's attachment works, but when two different students share a common grade in contigious rows the second student will be flagged as retained. This is not what we want. 

 

Shown here:

 

School_YearStudentIDGrade_HistoricalRetained Flag
2012-20139999910 
2013-20149999910R
2014-20159999911 
2012-2013111111 
2013-2014111112 
2014-2015111113 
2012-20132222223R
2013-20143333332 
2014-20153333333 

 

So, to solve this I created a seperate branch that creates a null() Grade_Historical along with the Max Year for each student. When these are unioned and sorted it creates a barrier record between groups of student records so the above won't happen. After you've run your Multi-row formula you can filter out the nulls. 

 

Looks like this

School_YearStudentIDGrade_HistoricalRetained Flag
2012-20139999910 
2013-20149999910R
2014-20159999911 
2014-201599999Null 
2012-2013111111 
2013-2014111112 
2014-2015111113 
2014-201611112Null 
2012-20132222223 
2012-2013222222Null 
2013-20143333332 
2014-20153333333 
2014-2016333333Null 

 

I don't know if this is the most efficent way of doing this but it seems to work. Workflow is attached. 

 

Thanks again, Joe!

JoeM
Alteryx Alumni (Retired)

@Caleb thanks for sharing your workaround! I made mention of a feature above, but probably should have highlighted the functionality more.  If you select a field the student id field to 'group by' in the multi-row formula, it would only perform the analysis per student. This would prevent the grade retention carry-over from student ID to student ID.  Note the config here:

multirow_config.png

Caleb
7 - Meteor

Oh, you sure did! 

 

Thank you, much simpler than mine. Smiley Embarassed

Labels