Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Multi Row formula

Zaid
8 - Asteroid

Hi All,

 

There is a minor hiccup that I am facing in trying to create a logic. I would be glad if anyone can help me on this. The requirement is such that, I am sure I need Multi-Row Formula to fix it, but somehow i am unable to nail the formula. 

 

Let us say we have three columns as, Name, Month, Gender.

Name MonthGender
TomJuly 
TomAugustM
TomSeptember 
LucyMay 
LucyJune 
LucyJulyF
LucyAugust 
LucySeptember 

 

In the data shown above, i would like to fill the Gender column for each Name if there is an entry in any single row, similar to one shown below.

 

Name MonthGender
TomJulyM
TomAugustM
TomSeptemberM
LucyMayF
LucyJuneF
LucyJulyF
LucyAugustF
LucySeptemberF

 

Thanks

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus
There are a couple of ways to achieve this, one is using a multirow and the second uses a filter and join.

For the multirow formula to work you need to ensure the value populated is at the top. So use a sort tool to sort by name ascending and the gender descending (or whichever way brings the filled in gender value to the top line).

You should choose the 'update existing field' in the multirow formula tool and select gender.

The statement you want is relatively simple.

IF ISNULL([Gender]) THEN [Row-1:Gender] ELSE [Gender] ENDIF

You should also include name as a group by field.

An alternative method would be to add a filter tool and remove instances where gender is not NULL. Take this stream and use a join tool to bring the value against the entire data stream using name as the join field.

Ben
Zaid
8 - Asteroid

Thanks 

 

 

BenMoss
ACE Emeritus
ACE Emeritus

That's great to hear @Zaid!

 

Would you mind marking the post as a solution just so this post is prioritised when people are searching for similar issues.

 

Ben

shalinipal
5 - Atom

You can simply configure a formula tool for the column GENDER and using the below expression can solve the problem.

 

IF [Name] = "Tom" THEN "M" ELSEIF [Name]="Lucy" THEN "F" ELSE [Gender] ENDIF

Labels