Forum Discussion
M_Waters-221
Bronze I
3 months agoIntroduction to Elastic: Ep.9 - ES|QL
I’m stuck on question 18 i need this to complete the lab. The question says ‘Perform a final query using all of the techniques used in the previous questions. What is the average speed per hour for ALL trips that start in the borough of “Brooklyn” and end in the borough of “Manhattan”? Provide your answer to at least three decimal places.
any ideas?
1 Reply
- netcat
Silver III
You filter for the relevant trips, but don't create an overall sum, but use the formula used in a question before to calculate the average speed per trip. Then do a sum of these and divide it by the number of results. You can count the number of results manually, or with STATS.
https://www.elastic.co/docs/reference/query-languages/esql/commands/processing-commands#esql-stats-by