cancel
Showing results for
Did you mean:

# Alteryx designer Discussions

SOLVED

## Multi Row formula

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 Month Gender Tom July Tom August M Tom September Lucy May Lucy June Lucy July F Lucy August Lucy September

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 Month Gender Tom July M Tom August M Tom September M Lucy May F Lucy June F Lucy July F Lucy August F Lucy September F

Thanks

Alteryx Certified Partner
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
Highlighted
Asteroid

Thanks

Alteryx Certified Partner

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

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