Average for a string field in Kibana visualization

Hi all,

I'm trying to find average for a string field and I want to show in a bar chart in Kibana by date.

In my dataset, Say I have hundreds of computers with a computer_id ( string field).
I have hundreds of Virus attacks in my computers with virus_attack_id( string field).

I can project just sum of virus attacks in all my systems in bar chart.

How do i display average virus attacks i.e count of virus attacks / number of computers as both my fields are string fields?

Hi @Sandeep_Raju ,

have you tried already to build a Metric visualization in Lens with a formula like:

count(kql='virus_attack_id: *') / count(kql='computer_id: *')

It is also possible to set the Percentage format to have a ratio of computer infected:

Thank you. Yes, It works in lens.

Another way I found out is by using TSVB
Then take count of both terms.

THen take Bucket script and use formula like above.

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