Forum Discussion
Drive Duration Calculation
cheid_4838 Since you want to subtract the previous departure time from the current arrival time, then you would put VAR __Current = [Arrival Date & Time].
You will want to capture the current driver and perhaps order similar to the __Current variable. You then need to use those when filtering to find your previous row.
I must be missing something because I keep getting a syntax error message. What am I missing?
Table = stops
- Greg_Deckler2 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_48382 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.