Singlestat sum of max values for different tags in a measurement

This is how my measurement looks like, vehicle is a tag. odo (odometer) and speed are fields.

time odo speed vehicle
2018-07-12 13:44:35 9.20 2.00 vehicle2
2018-07-12 13:44:20 9.40 10.00 vehicle2
2018-07-12 13:44:05 9.60 15.00 vehicle2
2018-07-12 13:43:50 9.80 25.00 vehicle2
2018-07-12 13:43:35 10.00 11.00 vehicle2
2018-07-12 10:56:48 0.20 1.00 vehicle1
2018-07-12 10:56:33 0.40 5.00 vehicle1
2018-07-12 10:56:18 0.60 13.00 vehicle1
2018-07-12 10:56:03 0.80 5.00 vehicle1

I created a variable “vehicle”, which queries my tag for selection so I can switch between vehicles on the dashboard, now when I select the “All” option, I want to be able to sum() just the max values of my tags to get the total mileage of all my vehicles. I am using influxdb as datasource.

image

Just a background, the max odo value of a vehicle is the total mileage of a single vehicle.

That is a use case for InfluxDB subquery. Something like:
SELECT SUM("max") FROM (SELECT MAX("odo") FROM telemetry WHERE ...)