Query aggregation question

I want to write a query to get the latest rows for each unique datapoint. For example here is my data

time DataPoint MinValue MaxValue AverageValue
1598399340000000000 B 477 477 477
1598399340000000000 A 13.8999996185303 13.8999996185303 13.8999996185303
1598399350000000000 B 482 482 482
1598399360000000000 C 482 482 482
1598399380000000000 A 59.99 59.99 59.99
1598399390000000000 B 30 30 30
1598399400000000000 C 479 479 479
1598399420000000000 C 481 481 481
1598399450000000000 B 90.3 90.3 90.3
1598399600000000000 B 84.2 84.2 84.2

Should return:
1598399380000000000 A 59.99 59.99 59.99
1598399600000000000 B 84.2 84.2 84.2
1598399420000000000 C 481 481 481

My guess is to do something like this but I cannot Max on time.
select MAX(time) from table GROUP BY DataPoint

Can someone help?
Thanks!

@fly161932 - perhaps the LAST() function will work for you? InfluxQL functions | InfluxDB OSS 1.8 Documentation

Please let us know how it goes.