# Create percentage graph from a string

**URL:** <https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252>\
**Category:** Kibana\
**Created:** [October 25, 2019, 12:17pm UTC](https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252 "2019-10-25T12:17:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Crespillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_crespillo/32/56608_2.png) [@David\_Crespillo](https://discuss.elastic.co/u/David_Crespillo)\
**Post date:** [October 25, 2019, 12:17pm UTC](https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252/1 "2019-10-25T12:17:12Z")

</div>

Hi,

I need to create a graph with porcentage from a search fields; these fields are string.

I mean, I have a "Total Data" field and I make a search from "Total Data" that show me wich of these are "NOK". I need new graph that show me the % between "Total Data" and "NOK" search from "Total Data".  
I tried into Scripted Fields in the Index Patterns...but doesn't work. I don't how I can do it.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [October 25, 2019, 4:54pm UTC](https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252/2 "2019-10-25T16:54:45Z")

</div>

Hi David,

If I understand correctly, you can do this with a Filters aggregation in a bucket. In the example below, I've created a pie chart with two filters. One for `category.keyword : "Men's Clothing"` and another for `NOT category.keyword : "Men's Clothing"`.

 ![56%20AM](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f12bbbb3721d1501c3d0c4f2bf83c9e731a8627b.jpeg)

---

<div class="post-metadata">

**Author:** ![David\_Crespillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_crespillo/32/56608_2.png) [@David\_Crespillo](https://discuss.elastic.co/u/David_Crespillo)\
**Post date:** [October 28, 2019, 7:45am UTC](https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252/3 "2019-10-28T07:45:37Z")

</div>

> [@nickpeihl](#):
>
> I've created a pie chart with two filters. One for `category.keyword : "Men's Clothing"`

Hi,

It's similar, but I need it in timeline with line graph.

Thanks for the quick answer.

---

<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:** [November 25, 2019, 7:45am UTC](https://discuss.elastic.co/t/create-percentage-graph-from-a-string/205252/4 "2019-11-25T07:45:47Z")

</div>

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