# Visualize 2 values evolution (sum) with a Pie chart

**URL:** https://discuss.elastic.co/t/visualize-2-values-evolution-sum-with-a-pie-chart/268669
**Category:** Kibana
**Created:** [March 29, 2021, 2:55pm UTC](https://discuss.elastic.co/t/visualize-2-values-evolution-sum-with-a-pie-chart/268669 "2021-03-29T14:55:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Anto1](https://discuss.elastic.co/u/Anto1)
#### Post date: [March 29, 2021, 2:55pm UTC](https://discuss.elastic.co/t/visualize-2-values-evolution-sum-with-a-pie-chart/268669/1 "2021-03-29T14:55:58Z")

</div>

Hello !

I'm kind of a beginner in creating Kibana visualizations, and I'm actually facing this issue :

- I have a lot of logs, and some are containing the following fields " **inSuccess**" (eg. 2), " **inError**" (eg. 1), which are numbers, corresponding to a specific calculation result return. Previously, I have a message with a field " **totalExpected**" which gave me the total amount of expected calculations (eg. 5, in this example we are still waiting 2 calculations).

- I want to display a Pie Chart using these metrics for something that I believe might be quite easy. First of all, I want it blue and corresponding to the cumulative value of every "totalExpected". Then, I want to have this blue to be "overprinted" by green then red, according to the cumulatives calculation successes, then fails.  
**So it should be three-colored (or two-colored, if every calculations results have been sent, in this case all blue should be overprinted by green and / or red).**

Do you know if it is possible ? I'm trying to configure my Pie chart for days, but I just cannot succeed to get what I want (not even close ...), so maybe it's impossible ... If so, can you please tell me how should I design my messages to display this ?

Thank you very much for your time ! 🙂

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [March 29, 2021, 5:08pm UTC](https://discuss.elastic.co/t/visualize-2-values-evolution-sum-with-a-pie-chart/268669/2 "2021-03-29T17:08:30Z")

</div>

Hi, welcome to the forums! If I understand your description, you have logs that are structured like this:

```auto
{ timestamp: 2021-01-01, totalExpected: 5, jobId: 1 }
{ timestamp: 2021-01-02, inSuccess: 2, inError: 1, jobId: 1 }
{ timestamp: 2021-01-02, inSuccess: 3, inError: 2, jobId: 1 }

```

Where you are tracking the _change in status_ over time. There are two major reasons that your problem is hard in Kibana:

1. You are trying to correlate something from one document to a later document. _You can't do this in a single query_, and Kibana is fundamentally a single-query system. To fix this, you need to change the way your data is stored so that all the related info is stored together.

2. The pie chart visualization in Kibana is one of the least powerful tools we offer, and does not support any kind of dynamic coloring.

The first problem is your most critical. You do need to change your data so that you can store all the related data in one document. Most likely, you should do this as a _separate index_ that contains the output data. For the documents I listed above, here is the only output I think you need:

```auto
{
  latestTimestamp: 2021-01-02
  totalExpected: 5
  completed: 3
  errorCount: 2
  jobId: 1
}

```

This is called an _entity-centric_ index, and is a very common pattern. We offer a tool to set up background jobs that do this automatically:

> **[Transforming data | Elasticsearch Reference \[7.12\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html)**

---

<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, 2021, 5:09pm UTC](https://discuss.elastic.co/t/visualize-2-values-evolution-sum-with-a-pie-chart/268669/3 "2021-04-26T17:09:08Z")

</div>

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