How do you calculate average speed?
You divide total distance by total time.
So if it takes you two hours to travel a distance of 100 km, your average speed is 100/2=50km/h.
It doesn’t matter whether you travelled at a constant speed of 50 km/h, or went faster part of the trip and slower during the rest of the time. It doesn’t even matter if you stopped for a refuel or a bite to eat.
Total distance divided by total time = average speed.