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

Alteryx Designer Desktop Discussions

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

Need help regarding Formula Tool

Lazzanova
7 - Meteor

Hello dear Alteryx Community members,

I'd like to solve something using the Formula tool. For this I'm using only 3 columns of data:

Lazzanova_0-1628087581150.png

I've got a list of date_actual, vehicle_id's, and a boolean regarding whether or not a car is stored (in_storage_on_compound)
I need the formula tool (or any other tool that gets the job done) to tell me if a car that is in_storage_on_compound on a given day, was not in_storage_on_compound a day before.

Ex: See row 28. This car is has in_storage_on_compound = 1 on 2021-06-30. And the day before in_storage_on_compound = 0 (2021-06-29)
I need the formula tool to add another column, let's call it storage_inflow, and for line 29 it should give the output of "True" or 1. 

Can anyone help me with this?

With kind regards,

Lazzanova (See attachment of example of data)

5 REPLIES 5
Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @Lazzanova ,

 

You can do it using a Multi-Row Formula checking both previous row value and current row value.

 

Workflow attached ! Tell me if it suits your need or not !

atcodedog05
22 - Nova
22 - Nova

Hi @Lazzanova 

 

You can use formula like below in multi-row formula tool.

 

String datatype:

 

IF [Row-1:in_storage_on_compound]="0" and [in_storage_on_compound]="1" THEN "1" ELSE "0" ENDIF

 

 

or

 

Numeric datatype:

 

IF [Row-1:in_storage_on_compound]=0 and [in_storage_on_compound]=1 THEN 1 ELSE 0 ENDIF

 

 

Workflow:

atcodedog05_0-1628088261726.png

 

Hope this helps : )

 

Lazzanova
7 - Meteor

Thanks Jean. That really helped me solve my problem!

Jean-Balteryx
16 - Nebula
16 - Nebula

You are welcome @Lazzanova ! @atcodedog05 's solution also is good and he offered the numeric one !

atcodedog05
22 - Nova
22 - Nova

Thanks @Jean-Balteryx , You did solve the actual problem and was faster 🙂👍

 

I copied the data to remove input file and ended up with properly datatyped data 😅

And later I had to update the response.

Labels
Top Solution Authors