We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Count most recent consecutive number of days

jhwth
6 - Meteoroid

I have an input similar to below:

DatesProduct AProduct BProduct CProduct D
2022-03-0101001000
2022-03-0210010000
2022-03-03100000
2022-03-04200000
2022-03-0520020000
2022-03-0620020000
2022-03-072002000100

 

My goal is to count the most recent # of consecutive dates from my latest day (which in this case is March 7th) backwards where the value is > 0. So I expect my answer to be:

  
Product A6
Product B3
Product C0
Product D1

 

Is there a way to do this in Alteryx? I've been playing with the formula tool but unsuccesful so far.

2 REPLIES 2
FinnCharlton
13 - Pulsar

Hi @jhwth , this workflow should work for you. I sort the data based on the dates, and then use a Multi-Row Formula tool to calculate the number of consecutive days since the latest day in the dataset. The formula isn't the cleanest and I'm sure there's a nicer way to do it, but this does the job.

FinnCharlton_0-1678725263489.png

 

BS_THE_ANALYST
15 - Aurora
15 - Aurora

@jhwth I added some extra data in to test if the logic holds up. Seems good:

BS_THE_ANALYST_1-1678732697882.pngBS_THE_ANALYST_0-1678732682373.png

 

 

All the best,
BS

LinkedIN

Bulien
Labels
Top Solution Authors