# Display a ratio of data

**URL:** https://discuss.elastic.co/t/display-a-ratio-of-data/265449
**Category:** Kibana
**Tags:** lens
**Created:** [February 25, 2021, 8:11am UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449 "2021-02-25T08:11:53Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)
#### Post date: [February 25, 2021, 8:11am UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/1 "2021-02-25T08:11:53Z")

</div>

Hi guys,

I have some difficulties with Kibana.  
My data contains IDs and links:

```auto
    {
        "_index": "debug_sample_data",
        "_type": "_doc",
        "_id": "rPeEz3cBYzpkMbM6YKCc",
        "_version": 1,
        "_score": null,
        "_source": {
            "datum": "2021-02-23",
            "id": "Egomotion_D_633",
            "links": [
                {
                    "id": "Egomotion_D_Link_0"
                },
                {
                    "id": "Egomotion_D_Link_1"
                }
            ]
       },
       "fields": {
           "datum": [
               "2021-02-23T00:00:00.000Z"
            ]
        },
       "highlight": {
            "id": [
               "@kibana-highlighted-field@Egomotion_D_633@/kibana-highlighted-field@"
            ]
        },
        "sort": [
            1614038400000
        ]
    }

```

Now I want a Pie chart or something similar, where 100% is my count of IDs. and X% is my number of IDs that have links.  
Is there a way I can achieve that with Kibana?

The queries I'm using for

- number of ids:  
id: _Egomotion_

- number of ids with links:  
id: _Egomotion_ and links.id: \*

Thanks in advance. I couldn't find any solution so far.

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [February 25, 2021, 10:50am UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/2 "2021-02-25T10:50:41Z")

</div>

You should be able to do this using the "filters" function.

For the "Size by" dimension, use the "Unique count of id" function, for the "slice by" dimension, use a filters function with these filters:  
`NOT links.id: *`  
`links.id: *`

 ![Screenshot 2021-02-25 at 11.50.21](https://us1.discourse-cdn.com/elastic/original/3X/3/8/38138b907fade48f403ff8c685780baa4bfe4825.png)

---

<div class="post-metadata">

### Author: ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)
#### Post date: [February 25, 2021, 3:02pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/3 "2021-02-25T15:02:15Z")

</div>

Great! Thanks flash1293!

Seems to work!  
Is it possible to display the number as percentage in the middel of the donut?

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [February 25, 2021, 4:08pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/4 "2021-02-25T16:08:17Z")

</div>

There's no way to show a number in the donut hole, but the number should be shown in the slices as percentage like this, right?

 ![Screenshot 2021-02-25 at 17.07.28](https://us1.discourse-cdn.com/elastic/original/3X/a/d/ada08191b875a2eb538d2c6a3c0e4eb6fcdcad65.png)

---

<div class="post-metadata">

### Author: ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)
#### Post date: [February 25, 2021, 4:16pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/5 "2021-02-25T16:16:51Z")

</div>

Unfortunanetly, it doesn't. Although I have "Show values" siwtched on in the Options tab.  
Only when I hover over it with the cursor.

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [February 25, 2021, 4:18pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/6 "2021-02-25T16:18:53Z")

</div>

Can you make a screenshot of your visualization? Which browser and which version of Kibana do you use?

---

<div class="post-metadata">

### Author: ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)
#### Post date: [February 25, 2021, 4:25pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/7 "2021-02-25T16:25:45Z")

</div>

Sure.  
I'm using Chrome.  
Version is 7.8.0 I think.

 ![Annotation](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d66e439cf60e95bb2e937e6a4abeea25d857c9f5.png)

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [February 25, 2021, 4:37pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/8 "2021-02-25T16:37:13Z")

</div>

You can enable "Show labels" then it will look like this:

 ![Screenshot 2021-02-25 at 17.34.03](https://us1.discourse-cdn.com/elastic/original/3X/d/d/dd337862c8ee297fcb2ba333d1863bfc251c5f08.png)

The screenshot I did is from Kibana \>7.10 - by using the Lens visualization you can get a much better looking pie chart.

---

<div class="post-metadata">

### Author: ![jazzdorf](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jazzdorf](https://discuss.elastic.co/u/jazzdorf)
#### Post date: [February 25, 2021, 8:34pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/9 "2021-02-25T20:34:34Z")

</div>

To be honest, I can't really figure out how to produce this donut chart with the lens visualization. Any suggestions would be appreciated!

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [February 26, 2021, 1:01pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/10 "2021-02-26T13:01:03Z")

</div>

As I mentioned, you need Kibana \>=7.10 for that. In 7.8 the Filters aggregation is not supported.

---

<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: [March 26, 2021, 1:01pm UTC](https://discuss.elastic.co/t/display-a-ratio-of-data/265449/11 "2021-03-26T13:01:05Z")

</div>

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