# Creating success rate based on boolean field

**URL:** <https://discuss.elastic.co/t/creating-success-rate-based-on-boolean-field/311812>\
**Category:** Elasticsearch\
**Created:** [August 10, 2022, 9:36am UTC](https://discuss.elastic.co/t/creating-success-rate-based-on-boolean-field/311812 "2022-08-10T09:36:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frederico](https://avatars.discourse-cdn.com/v4/letter/f/4af34b/32.png) [@frederico](https://discuss.elastic.co/u/frederico)\
**Post date:** [August 10, 2022, 9:36am UTC](https://discuss.elastic.co/t/creating-success-rate-based-on-boolean-field/311812/1 "2022-08-10T09:36:30Z")

</div>

Hello,  
I'm using elk 7.11.2  
I want to do a line chart where I plot a ratio over time of a certain boolean field.  
Ie, i want aggregate by time (minutes or hours) and plot the percentage of records where the boolean field is equal to "true" per example

This is the filed i want to plot:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/d/9d1c11704141fec1c8b28a7472f8fc6f9b332009.png)

And the goals is to do something similar to the image shown below:  
 ![ratiosuccess](https://us1.discourse-cdn.com/elastic/original/3X/6/3/632b326ae5d55d74c0fe09f6c68fe702429cf0cd.jpeg)

Thank you in advance,  
Frederico

-----EDIT------  
I managed to do it, by creating a calculated field and transforming true into 1 and false into 0, and then do a simple line chart where I display the average by hour.  
What if I want to show the same but in a field with many possible string values? Basically to show the most common ones in percentage aggregated by time

---

<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:** [September 7, 2022, 9:36am UTC](https://discuss.elastic.co/t/creating-success-rate-based-on-boolean-field/311812/2 "2022-09-07T09:36:56Z")

</div>

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