Skip to main content
All CollectionsData AnalysisGremlin training
Gremlin Training 16: Basic aggregation steps - mean()
Gremlin Training 16: Basic aggregation steps - mean()

Learn to use the mean()-step to calculate the average value from a collection of numerical values in your fields.

Kristine Marhilevica avatar
Written by Kristine Marhilevica
Updated over a year ago

Just like the sum()-step, the mean()-step works on a collection of numerical values.

The following query returns the average of all the total_direct_cost fields on applications.

g.V().
hasLabel('Application').
values('total_direct_cost').
mean()

sum()-step

Did this answer your question?