# Pie chart on accumulated data

**URL:** <https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545>\
**Category:** Kibana\
**Created:** [March 24, 2022, 9:04am UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545 "2022-03-24T09:04:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarioRojas](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@MarioRojas](https://discuss.elastic.co/u/MarioRojas)\
**Post date:** [March 24, 2022, 9:04am UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545/1 "2022-03-24T09:04:17Z")

</div>

Hi All,  
I'm very new to Kibana and I need to create a pie chart based on the sum of the values present in different logs, marginalized from a given term in yet another log...

In Discover the data looks like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/7/7752abd2f1febc7c3a5dda88d945d428bcc96323.png)

What I need is to have as slices the sum of the event\_counts (in this case slice fn should be 68 ). Furthermore, these values are only present, when result\_type is "summary".  
I've tried creating the pie based on the filter 'result\_type is "summary" ' and adding one bucket per even\_count but all I've been able to achieve is three concentric rings each divided in six sectors..

I appreciate any suggestions on how to do this (if it can be done) or if there are ideas on even another visualization that can show the sums of these columns, as percentages of the total amount of events.

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [March 24, 2022, 10:33am UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545/2 "2022-03-24T10:33:22Z")

</div>

Hi Mario, unfortunately the way this data is structured doesn't allow you to slice a pie it in easy way (you slice across one field that has different values).

What you can do though, is to get a datatable or a stacked bar chart where you sum these events as separate metrics. Here's the example with using Lens formula:

 ![Screenshot 2022-03-24 at 11.25.38](https://us1.discourse-cdn.com/elastic/original/3X/6/7/67d6334266e58208923448d0eded4a3ccf50aac5.png)

the formula for the first event would be:  
`overall_sum(sum(event1))/(overall_sum(sum(event1))+overall_sum(sum(event2))+overall_sum(sum(event3)))`  
for the second:  
`overall_sum(sum(event2))/(overall_sum(sum(event1))+overall_sum(sum(event2))+overall_sum(sum(event3)))`  
and the third:  
`overall_sum(sum(event3))/(overall_sum(sum(event1))+overall_sum(sum(event2))+overall_sum(sum(event3)))`

The value format allows you to format the data to percentages:

 ![Screenshot 2022-03-24 at 11.33.07](https://us1.discourse-cdn.com/elastic/original/3X/0/3/0364118d6c42c4c6b2eece50bc456f7bb48caf97.png)

Use the chart switcher to try out different chart options.

 ![Screenshot 2022-03-24 at 11.30.42](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85e91234f72e8751f4af000e87222a36ccf10622.png)

---

<div class="post-metadata">

**Author:** ![MarioRojas](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@MarioRojas](https://discuss.elastic.co/u/MarioRojas)\
**Post date:** [March 24, 2022, 12:28pm UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545/3 "2022-03-24T12:28:51Z")

</div>

Hi Marta,

Thanks for the quick answer!  
I was able to get a percentage visualization using the vertical bars and the formulas you suggested.

Thanks again for the support!

---

<div class="post-metadata">

**Author:** ![MarioRojas](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@MarioRojas](https://discuss.elastic.co/u/MarioRojas)\
**Post date:** [March 29, 2022, 1:25pm UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545/4 "2022-03-29T13:25:38Z")

</div>

Hi again,

I was happy with the visualization 😄 , until it was pointed out to me, that, when applying a filter on another variable , the values go blank ☹ .  
I have checked and in Discovery, i see that these are sort of mutually exclusive.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/2/821e2796ff0815f27f909fd7280705f3d8543c53.png)  
so, if they filter by "extended" for example, the values in summary are gone and the formulas dont have anything to show...  
Would bucket aggregations work here? (sum of buckets in a metric visualization perhaps?)  
I mean, i see that what I need is for example to be able to marginalize per type of object, just haven't managed to combine the two ...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2022, 1:26pm UTC](https://discuss.elastic.co/t/pie-chart-on-accumulated-data/300545/5 "2022-04-26T13:26:06Z")

</div>

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