# Alteryx Designer

Andy Uttley, Alteryx ACE, makes music with Alteryx | Math + Music

## Implement if

Highlighted
8 - Asteroid

Hi

I need to get the row for the same order which isn't null in the time field(have time), if all of them are null(There is no time in all of the row for the same order), I would like to get the null.

In the output, I need to get an order with time or null, but not both.

Thanks for help

Highlighted
Alteryx

Hi @Borisham --

So I created this sample set:

What I did next to make the Multi-Row expression a little simpler is sort by OrderID and Date so that any item that has a date is on top. I then used the multi-row formula building block to replace any Null dates with dates, only if there is a date in that OrderID:

I've attached the workflow to this post.. Hope this helps!

Highlighted
10 - Fireball

It's not overly clear what you're asking, however, the attached could help if I'm understanding you correctly.

I've used the FindReplace tool to append a time to the Order Numbers. The tool will append the last match it finds so the descending sort is key.

If this isn't what you're looking for could you provide an example of your data please?

Highlighted
12 - Quasar

Hi, @Borisham

Try these.

Please mark as solution + like, if they work for you.

The workflow is attached.

Cheers!

Highlighted
8 - Asteroid

That looks great, but I can open your workflow, I don't know why I can run the if with [Row-1:data_field]

Thanks for help

Highlighted
Alteryx

Hi @Borisham --

I hope i'm understanding your question correctly. But to open the packaged workflow I attached, open it from Alteryx Designer and select 'Import' and then 'Yes'. I've also attached it as a .yxmd

The Multi-Row Formula will allow you to do a calculation against multiple rows so [Row-1:data_field] means look at the previous row (-1) and use that value in the current row (+0). When you use this with your own data, use the variables section in the configuration window to select the data field you want to work with:

And make sure you 'Group By' the OrderID to make sure it works correctly!

If this solution worked, make sure you mark it as a solution!

Highlighted
8 - Asteroid

@AshleyL  Thank you so much

It's not solved my problem. I will try to explain it again

I have 6 different fields with different data at some times.

I would like to get for the same order the line that holds a date who is not null on the date field. if all of them are null, pick one.

I need to get on the output just with one row for one order

Highlighted
10 - Fireball

Is this the kind of thing you're looking for?

Labels