I am using kibana 4
I generated a table using kibana aggregation, it has two metrics: sum of profits, and count. How do I add another metric to calculate the average profit per count by doing profits.value / count.value ?

I am using kibana 4
I generated a table using kibana aggregation, it has two metrics: sum of profits, and count. How do I add another metric to calculate the average profit per count by doing profits.value / count.value ?

Hi Sharon,
If both profits and count are formatted as number fields, then you could create a scripted field under Management > Index Fields > Scripted Field tab. Your scripted field would calculate the profits / count per document, and then you could Metric Sum Aggregation for this field to display it as another column in the table.
Does this help?
Thanks,
CJ
CJ, I think in this case "count" is the document count, and Profits is the Sum of a field. So a scripted field can't work because each document represents a count of 1.
Sharon, I think you can get the average if you're OK with having it on another visualization (and then you could have your current one and this average one next to each other on a Dashboard).
Can you try something like this?

© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.