I have information from two cameras: the car number, the camera, and the date time. The first camera is A, while the second is B.
I need to figure out what the average speed was for automobiles that passed both cameras with a passage period of at least 5 minutes and no more than 30 minutes. The cameras are 6 kilometres apart.
Only the nearest car crossing timings for the same car were counted. For the nearest A crossing time, I couldn't find the camera B crossing time.
Diff_time =
VAR temp =
TOPN (
1;
FILTER (
'TEST2';
'TEST2'[license_plate] = EARLIER ( 'TEST2'[license_plate])
&& 'TEST2'[Date_time] < EARLIER ( 'TEST2'[Date_time] )
);
'TEST2'[Date_time]; DESC
)
RETURN
DATEDIFF ( MINX ( temp; 'TEST2'[Date_time] ); 'TEST2'[Date_time]; MINUTE )
[license_plate] is car number.