Hi there,
I have the following table:
We got for every part diffrent timestamps with a specific work done there.
I would like to calculate the date between the installation and removal date.
The problem ist, that for one part there can be historical data with multiple removals and installtions (like you see in 'Y'). Here I would like to calculate the difference by taking the installtion data followed by the date of the next removal.
I tried the Lead Function:
DATEDIFF(DD, (Lead ( ('DATE'), ORDER BY ('DATE' DESC), PARTITION BY ('PART', 'WORK'),1)), (DATE) )
The problem here is that this function calculates only the days between the removals.
Do you guys have any idea how I can get the dates between the installation and removals dates?
Thank you and best regards!