If you are using Vega-Lite then you would use aggregate and calculate most likely. There are examples on the pages but most likely won't be exactly what you need depending on your data.
It might be worth your time to view all the examples and check the spec to help learn what's going on.