Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Loops in Alteryx

altrx_guy
5 - Atom

Hi All,

 

I am trying to solve a problem where I want this input 

 

altrx_guy_0-1684815773047.png

to be converted to this output

altrx_guy_1-1684815817575.png

 

The logic behind this should be - Loop through the data and check where Value = 0, If Value = 0 check if previous row is 1 and if this condition is True (extract the Timestamp Value for the Value = 0), Now look for Value = 1 afterwards, as soon as we get 1, extract the timestamp value for that (Final Timestamp). If the sequence is 1, 0, 1 - it's easy but what if there are 100 zeros between 2 1s. So we basically have to make Groups of these kind of patterns (type 1 : 1, 0, 1 and in other cases, it should be 1, 0, 0,1 or 1,0,0,0,0,0,1 and so on) and then fetch minimum and maximum timestamp for each group. Please suggest me the best solution. It could be direct or through Iterative Macros.

 

Thanks in advance!!!

2 REPLIES 2
Christina_H
14 - Magnetar

I don't know if it's the best solution, but I think this works:

Christina_H_0-1684838807871.png

I'm generating data using random values so it won't look the same every time, but I believe the groups are correct based on your description.

altrx_guy
5 - Atom

Thank you so much!!! I really appreciate your quick response. 

Labels