Forum Discussion
cheid_4838
2 years agoHelper IV
Drive Duration Calculation
I am probably making this harder than it needs to be, but I am trying to calculate the driving time between each stop sequence for each order. For example for stop 2 for order 6005581 I need to know...
Greg_Deckler
2 years agoCommunity Champion
Drive Duration =
VAR CURRENT = stops[stp_arrivaldate]
VAR PreviousDate = MAXX(FILTER(stops,stops[stp_departuredate] < CURRENT), [stp_departuredate])
RETURN
(_Current - _PreviousDate)*1.
cheid_4838
2 years agoHelper IV
I appreciate the help with this, but for some reason it's still not working. From the looks of it, it should work. Do you know what could be driving this error message? Thanks.
- Greg_Deckler2 years agoCommunity Champion
cheid_4838 For whatever reason and to my knowledge undocumented, CURRENT seems to be some sort of reserved word, which is why it is always a good idea to prefix variable names with __ or _ or some other character. So just do that.