Alteryx designer Discussions

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

Calculating Historical Date Differences

Highlighted
8 - Asteroid

Hello,

 

I have the following Exit History data showing which year(s) an employee left the company. For this example, the assumption is that even though the employee left, they returned the next year and continued to work with the company until today. This can happen multiple times as it did with Tom.  

NameExit Year
Tom2009
Tom2011
Tom2015
Sally2010

 

 

I have a History table that shows the individual's data from 2007 to the present. Using that History table, I am trying to calculate how long it was from the year (RowYear) until their Exit.  Here is what I am trying to achieve: 

NameRow YearYears from Exit
Tom20072
Tom20081
Tom20090
Tom20101
Tom20110
Tom20123
Tom20132
Tom20141
Tom20150
Tom2016 -
Tom2017 -
Tom2018 -
Sally20073
Sally20082
Sally20091
Sally20100
Sally2011 -
Sally2012 -
Sally2013 -
Sally2014 -
Sally2015 -
Sally2016 -
Sally2017 -
Sally2018 -

 

What would be the best way to do these calculations? 

 

I tried the multi-row calculation and got pretty close, but the IF statement was getting unwieldy. 

 

Thank you for the help.

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Here's how I would go about solving the problem, example workflow attached.

 

problem.png

Ben

Highlighted
13 - Pulsar

Here you go !

Highlighted
8 - Asteroid

Ben,

 

Thank you for sending this. It worked very well for me.

 

G

Highlighted
8 - Asteroid

Ponraj,

 

I really love this solution! It was clear and easy for me to understand. 

 

Thank you!

 

G

Labels