MPG/KML Calculation For Dashboard?

Has anyone figured out how to calculate MPG or KML and add it to the dashboard? It would be a great addition to the trip information.