Forum Discussion

fosterXO's avatar
fosterXO
Frequent Visitor
3 years ago

Calculate date diff for all combinations

Hi 

I need to calculate the time it takes for trucks to go from one station to another so I can select any origin and destination in my dataset and calculate the average time for all or different trucks that did that route.

 

This is how the data could look like this. Assume truck 1 started on 00-01-2022:

 

Stoptruck numberorigindestinationarrival date
11AB05-01-2022
21BC10-01-2022
31CD20-01-2022
41DE

30-01-2022

 

We would need to get all the combinations from origin and destination for the following X destination for a particular origin. It would be great if it could ve a parameter so we say that we want the following table but only from a destination to the next X destinstions (in the example it would be x=4):

 

OriginDestinationDiff Timetruck number 
AB5 days1
AC10 days1
AD20 days1
AE30 days1
BC5 day1
BD15 days1
BE25 days1
CD10 days1
CE20 days1

 

And few more. Main question would be how to calculate all combinations for x stops in the future. The dataset is huge and I xan not calculate all stops for a truck 

4 Replies