Alteryx Designer Desktop Discussions

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

Consecutive dates until condition is met

K_tina
6 - Meteoroid

Hi, I am new to Alteryx and would like to perform the following data manipulation. Any help is appreciated.

 

Sample of my data below. I need to add the number of days in “Buffer” to “Date” and stop the logic when “Flag” is marked as 1. I.e. no more calculations to be done after the first Flag = 1 is encountered.

 

How can I do a “loop” in Alteryx?

 

Thanks

IMG-20221219-WA0004.jpg

9 REPLIES 9
Adrian_T
Alteryx Alumni (Retired)

Hey @K_tina,

 

This can be achieved using the DateTimeAdd Function and conditional statement in a Multi-Row Formula Tool. This thread (LINK) should give you a good idea of how to achieve this.

 

Hope this helps!

DataNath
17 - Castor

Interesting with the flag added in @K_tina - I've just added a running total to identify where the flag starts and then after that, used a formula to add the days if the flag hasn't yet been reached i.e. has a value of 0:

 

DataNath_0-1671463573419.png

DataNath_1-1671463582400.png

 

The Formula expression here may look a little crazy. That's because your incoming date is in dd/mm/yyyy format which Alteryx can't deal with, therefore we need to parse it out into ISO format (yyyy-mm-dd) so we can use DateTime functions on the result. I've then wrapped it in DateTimeFunction to return to your original format. The final select simply removes the temporary running total field that was used for the buffer logic.

K_tina
6 - Meteoroid

Okay thanks i will go check it out, thanks for the quick and comprehensive responses!

DavidSkaife
13 - Pulsar

Hi @K_tina 

 

Here is one way of doing it:

DavidSkaife_0-1671463768671.png

 

A multi-row formula that creates a dummy field to filter out all records after the flag field, it then calculates the revised date using the fields provided, before Unioning the data streams back together and removing the dummy field created initially.

 

I've set it to include the row that has the flag on it, if you want it to stop on the row prior then change the formula in the Multi-row tool to the below:

 

IF [Flag] = 1 or [Row-1:Test] = 1 THEN 1
ELSE 0
ENDIF

 

ShankerV
17 - Castor

Hi @K_tina 

 

We can achieve the solution in many ways. One simple method to achieve this is below.

 

Solution 1:

ShankerV_0-1671503329102.pngShankerV_1-1671503346305.png

 

Solution 2:

 

ShankerV_2-1671503412215.png

ShankerV_4-1671503477298.png

Note: The workflow used to achieve the solution is attached which can be downloaded to see how the solution works.

 

If you believe your problem has been resolved. Please mark helpful answers as a solution so that future users with the same problem can find them more easily!!!!

 

Many thanks

Shanker V

 

 

K_tina
6 - Meteoroid

Thanks for the comprehensive solution @shankerV. I had to review my workflow again and made some tweaks using on your suggestions! 

ShankerV
17 - Castor

Hi @K_tina 

 

Thanks, glad my solution helped.

Let me know if you have any more questions. 

 

Many thanks

Shanker V

 

K_tina
6 - Meteoroid

Hi ShankerV, I have a separate question on the email tool, are you able to help for that too? 

Thank you

ShankerV
17 - Castor

Hi @K_tina 

 

To send emails, connection is required.

 

ShankerV_0-1672428994583.png

 

The below blog will help you to do the connection settings for Outlook, Gmail etc.

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/SMTP-Configuration-of-Common-Email-...

 

Many thanks

Shanker V

Labels