Show bar horizontal as percentage

Hello, i have this bar horizontal lens:

I wanted to show the numbers of volume_total (5,797,557) as percentage (the application_name's volume_total divided by the sum of volume_total of all application). But if i use bar horizontal percentage, all shows as 100%:

for more context, volume_total is a field which value is from index template's runtime field of adding 2 other field (volume_in and volume_out). my example log:

name, volume_in, volume_out, volume_total (runtime field)
abc,10,20,30
def,20,30,50
ghi,15,15,30

Hey @mikhatanu :wave:,

I'm not sure I understand what you want but I hope some context would help you get there.

First of all, the Bar horizontal percentage visualization type computes the percentages based on the values within the given buckets. As your first image shows, you only have one value in each bucket, the buckets defined as Top 10 values of application_name. Thus each value within the three separate buckets is 100% of the bucket size.

Secondly, I think the solution for you would be to use a lens formula with the overall_sum function, see Percent of total example example in the docs.

This function is defined in greater detail in the Formula reference docs in Lens, see docs reference below...

With this function you are able to determine cumulative sums across all series, then equate the series to a percentage of the total. This formula would look something like...

sum(volume_total) / overall_sum(sum(volume_total))

Note: you can set the Value format of the resulting value from the formula in the popout as a Percent type.

Then using the Bar horizontal stacked visualization type you would have a resulting visualization like this...

Screen Recording 2022-12-08 at 02.26.21 PM

Hope that helps.

1 Like

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