How to get Percentage from count of records

Hi there,

I'm using Elastic and kibana v7.17, and I want to get the percentage from each term in my table. look at this picture below
image
as you can see there are many counts of records of each term on the right side, how if I want to change that to become a percentage? so the formula will look like this (count of record of each term / count of record of all logs in that timerange)

is that possible to do that using a formula in the lens? if yes, how to do it? since the count function didn't accept any field inside it.

I already tried using a formula like this but it gives me 100% from all terms while I calculate manually it shouldn't get 100%

count(kql='ip_mask:*')/ count()

Thank you

Hi ,

Maybe this article could help you:
https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations

Best

Hi Alex,

I already tried TSVB too. Since i only took count of records from each term, i don't know what should i write in the numerator part. After i group the data by field, it also gives me 100% while the actual data doesn't reach 100. I tried to use pie also. It can show the percentage but not suitable if I want to show the top 50. That's why I moved to a table visualization. Do you have any other ideas?

Thanks

Pada tanggal Jum, 23 Feb 2024 02.01, Alex Salgado via Discuss the Elastic Stack <notifications@elastic.discoursemail.com> menulis:

I found the formula. it's using overall_sum function

count() / overall_sum(count())

and then I add one more count metric to sort the data in descending

Awesome! Is it working now?

yes, now I'm able to create a table visualization with a percentage in it

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