# How to divide and visualize two aggregated data？

As a beginner of Kibana, I feel very powerful. However, there is a problem that cannot be realized at present, so I hereby ask for advice.
Suppose I have two fields, named 'key1' and 'key2', and aggregation them by 1 minute.
first,i want to aggregation them.sum(key1.data) and sum(key2.data)
and then the Calculate division value Such as sum(key1.data)/sum(key2.data)
then visualize the data by interval of 1 minute.

This is very useful in the scenario of statistic global average speed, I hope someone can help me solve it, thank you!

Create a Transformation in Kibana and then use the transformation index as your visualization data source 1 Like

Other possible options may be

although I haven't actually tried them.

1 Like

Thanks to everyone above, I have solved this problem by using Timelion graph drawing, the syntax is:

.es(index=mylog-,timefield=@timestamp,metric=sum:key1).divide(.es(index=mylog-,timefield=@timestamp,metric=sum:key2)).label('speed' )

So you can calculate the overall speed!

1 Like

Thank you for sharing an elegant solution!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.