Hi Alteryx Community,
As the title suggests, I'm trying to find a way to use some loop logic in an analysis.
I have attached an example and want to work you through the logic.
We have a customer that has multiple loans, some are already closed, some are still active/open.
The goal? to calculate the cumulative amount of time that the customer actually had loans with us - based on a 12month period determination.
For example, if a customer had a loan from 2000 to 2010 and then from 2020 to 2024, then the customer has maintained an actual relationship with us for (10) + (4) = 14 years, not 2024. Simple, right?
However, we need to account for dynamic situations.
For example,
(1) if multiple loans opened in 2000 and are ALL closed, I want alteryx to calculate the longest relationship.
(2) for the 12month period determination, I want alteryx to look for the chronological passage of time, not the successive. So, if loan (A) opened in 2004 and closed in 2010, loan (B) opened in 2004 and closed in 2008, and loan (C) opened in 2012, I need alteryx to look for the chronological difference, meaning to subtract 2010 from 2012 - and not 2008 from 2012. So in this case, the gap is actually 2 years, not 4.
Then the logic continues... from loan (C) to (D)... and on to the next until we have a cumulative count.
Would greatly appreciate it if someone could come up with some logic that can be applied to this situation. Seems like coding would be the solution, but I'm in the hope that Alteryx can also offer the solution.
Thank you very much,