Forum Discussion
jeffw14
1 year agoHelper I
Getting Date from Next Row
Need DAX code to get the date from the row of that vehicle ID's next pickup. Have Vehicle ID data that contains a Pickup Date and a Drop Date with the State it drops in. I need to know how long each ...
Anonymous
1 year agoNot applicable
Hi, jeffw14
You can try the following methods.
Measure =
Var _Nextpickup=CALCULATE(MIN('Table'[PickupDate]),FILTER(ALLEXCEPT('Table','Table'[VehicleID]),[PickupDate]>MAX('Table'[PickupDate])))
Var _diff=ABS(DATEDIFF(MAX('Table'[DropDate]),_Nextpickup,DAY))
RETURN
IF(_Nextpickup<>BLANK(),_diff)
Please see the attached document.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jeffw14
1 year agoHelper I
Thank you, as an added wrinkle to this that I forgot, if the vehicle has a drop date before today's date and no pickup after that, is there a way to always default the Next Pickup Date calculation to today's date? Then the Next Pickup Date would continue to automatically update and thus update the amount of time the driver is sitting, until the driver receives their next pickup and another entry is added to the database.
- Anonymous1 year agoNot applicable