Average sum calculation in kibana


(Vandana Sethi) #1

hello I have created a metric that shows sum of a field . It is for calculating revenue now I want to create a one more metric that will show the average of revenue not the average of that field . I am confused how can i do it . example what I did
field1 = 2, 3, 4 ,5,6
metric one = 20
metric two should not be the average of field1 instead it should be average sum per time .


(Peter Pisljar) #2

Hi Vandana,

i am not sure i understand your question correctly ....

so your metric one is 20 (why did you need to create your own sum metric ? sum metric is already there in kibana?)
how can you do an average on just one number ? your first metric will always make a sum of all the values ... so it will only return one value ...


(Spencer Alger) #3

if field 1 a multi-value field? or is that representing the value of field1 from 5 documents?

If it's the former then you could use a scripted field as the field for the average metric agg. If the values are in different documents then I'm afraid you won't be able to accomplish this without pipeline aggregations.

timelion is a great tool for this type of metric calculation, and will absolutely help you do just that.


(Shreyanshu Pare) #4

I have one doubt, i am working on Timelion
i also want to find Average of two data , How we will do?Please suggest me.

.es(index=indexname,timefield='timefield',metric='avg:(onedata,twodata)')

is it correct?


(system) #5