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

Identify dates with three or more consecutive zeros

SerhatB
5 - Atom

I have the following daily production data for each machine and I need to identify all the dates where the machine did not work for a minimum of 3 days. I should count dates only after the machine worked for at least 3 consecutive days. For example, Jan 2-4 below should not be counted because the machine did not work for 3 consecutive days yet until those dates.

 

MachineDateProduction
A1/1/20211
A1/2/20210
A1/3/20210
A1/4/20210
A1/5/20211
A1/6/20211
A1/7/20211
A1/8/20210
A1/9/20210
A1/10/20210
A1/11/20217
A1/12/20210
A1/13/20210
A1/14/20210
A1/15/20210
A1/16/20212
A1/17/20213
A1/18/20214
A1/19/20210
A1/20/20210

 

The output should look like the table below:

MachineStart DateNumber of Days
A1/8/20213
A1/12/20214
B….….

 

Highly appreciate your help! 

 

8 REPLIES 8
Qiu
21 - Polaris
21 - Polaris

@SerhatB 

Why 1/2/2021 will not be counted?

Capture53.PNG

SerhatB
5 - Atom

@Qiu, The machine should work for at least 3 consecutive days (>0 production) before we identify consecutive zeros. Therefore, we should start identifying consecutive min 3 days zeroes after Jan 7 for Machine A because it worked for 3 consecutive days first time on Jan 5-7.

 

Thanks a lot for your help!

Qiu
21 - Polaris
21 - Polaris

@SerhatB 

But  before 1/12/2021  does not have  3 consecutive days work also.

Qiu
21 - Polaris
21 - Polaris

@SerhatB 
Anyway, if I consider 1/12/2021 is a mistake.

Capture54.PNG

SerhatB
5 - Atom

3 consecutive production days not necessarily need to be immediately before the 3 consecutive zero production days. It can be at anytime in the dataset. In this case, there is a consecutive 3 days production at Jan 5-7 and we can start counting consecutive zero productions after Jan 7. Thank you!

Qiu
21 - Polaris
21 - Polaris

@SerhatB 

I think you just made it simplier. 😁

Capture55.PNG

SerhatB
5 - Atom

Thank you very much Qiu, this is super helpful! 🙏

Qiu
21 - Polaris
21 - Polaris

@SerhatB 
Glad to help and thank you for the accept mark

Labels
Top Solution Authors