# Average(wrt time) of Sum of Values

I have logs with "product name", "sales", "date", "salesman". I want the average value of sales done by all salesmen product-wise. i.e., Average(wrt time) of sum of all the sales of same product. If I use Average as the aggregator, it is giving the average sales per salesman per time, if i use Sum as aggregator, it is giving the sum of all the sales in particular time interval

This sounds like you need nested aggs, which kibana is very good with. I would do a terms split for the x-axis, by "product name", then i the sum of sales. You could then a filter based on salesman name.

@ Khalah_Jones_Golden,
Thanks Jones, I tried in that way but it is also taking the sum of all the values in a particular interval. What I require is to take the resultant average.

Here is my situation:
Data with 2 salesmen and Product1
salesman1 with a sales of x1 on day1 for Product1
salesman2 with a sales of y1 on day1 for Product1
...
salesman1 with a sales of x30 on day30 for Product1
salesman2 with a sales of y30 on day30 for Product1

With an interval of week, It is giving me the o/p: (x1+y1+x2+y2+...x7+y7), (x8+y8+x9+.....x14+y14)
Where as I require (x1+y1+x2+y2+...x7+y7)/7, (x8+y8+x9+.....x14+y14)/7.

you can use the average as a metric, either as a sub agg, or as the y axis.