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

Calculating Historical Date Differences

gumbatman
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.

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus

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

 

problem.png

Ben

ponraj
13 - Pulsar

Here you go !

gumbatman
8 - Asteroid

Ben,

 

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

 

G

gumbatman
8 - Asteroid

Ponraj,

 

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

 

Thank you!

 

G

Labels