# How to create a GAUGE using filter ratio

**URL:** https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689
**Category:** Kibana
**Created:** [June 11, 2020, 11:26am UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689 "2020-06-11T11:26:51Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![inchirah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inchirah/32/48145_2.png) [@inchirah](https://discuss.elastic.co/u/inchirah)
#### Post date: [June 11, 2020, 11:26am UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/1 "2020-06-11T11:26:51Z")

</div>

Hello @flash1293,

I took your advice and I used **TSVB**.  
I tried to create **GAUGE** that showes the total **number of attempt** and the portion of **attempt compliant number**.  
For that I used a **filter ratio** , but I didn't know how to used correctly.  
This capture from my try.

 ![111](https://us1.discourse-cdn.com/elastic/original/3X/7/1/71b7d80d1b75cc33f870b9fea858777230e88b56.png)  
And i want to get sthg similar to this:

 ![222](https://us1.discourse-cdn.com/elastic/original/3X/b/e/be8b33b2a8bf9bd12576984fc7bfb2787222e034.png)

Could you please help me.

---

<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: [June 12, 2020, 7:53am UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/2 "2020-06-12T07:53:43Z")

</div>

I don't know where you got the syntax you are using (with `where`), but you should use Lucene in here. Try

- Numerator: `Constrainte:[-78 TO *]`
- Denominator: `*`

That should give you the ratio you are interested in. No need to work with `_id` here, as you are only after the count of documents matched by each query.

You can modify the styling in the "Panel options" tab.

---

<div class="post-metadata">

### Author: ![inchirah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inchirah/32/48145_2.png) [@inchirah](https://discuss.elastic.co/u/inchirah)
#### Post date: [June 12, 2020, 10:13am UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/3 "2020-06-12T10:13:28Z")

</div>

HI @flash1293  
first thank's for help,  
second i did what you told but i get 0 like below:

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/8/3/83b58a8f5c4088f6d6798a952259176436568bf0.png)  
And about the picture tha t i told you i want sthg similar to it, i meant i want percentage of  
attempt compliant number compared to the hole attempt number.

---

<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: [June 12, 2020, 11:12am UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/4 "2020-06-12T11:12:25Z")

</div>

Remove the "Query string" - this is handled by the filter ratio.  
You can change the number format, I think it's part of the "Options" tab.

---

<div class="post-metadata">

### Author: ![inchirah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inchirah/32/48145_2.png) [@inchirah](https://discuss.elastic.co/u/inchirah)
#### Post date: [June 12, 2020, 12:13pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/5 "2020-06-12T12:13:48Z")

</div>

I'm sorry but still dosen't work  
that's capture from Data and Panel options

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb5d23a0308131aab0e682a5b26cc56ea439aee1.png) ![2](https://us1.discourse-cdn.com/elastic/original/3X/9/9/99a34c563c69d23607d9a0f1d6bccac40be5d606.png)

I couldn't figure out what's wrong.

---

<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: [June 12, 2020, 12:15pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/6 "2020-06-12T12:15:51Z")

</div>

The numerator is wrong, please check my post from above.

---

<div class="post-metadata">

### Author: ![inchirah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inchirah/32/48145_2.png) [@inchirah](https://discuss.elastic.co/u/inchirah)
#### Post date: [June 12, 2020, 12:43pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/7 "2020-06-12T12:43:07Z")

</div>

Hey it works  
but it gives me wrong number  
The number of attempt compliant(Contrainte\>=-78) is 1638 from 2631 observations  
So it should be 62.25%

 ![3](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0f0745aceee8c11230faf6704d3de01cf9749d0c.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: [June 12, 2020, 1:20pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/8 "2020-06-12T13:20:18Z")

</div>

Things that could cause this:

- Wrong index pattern
- Time range does not include all documents
- "Data timerange mode" is not set to "Entire time range" in the Panel options

To make sure there are actually 1638 documents matching this query, go to discover, search for `Contrainte >= -78` and check the total hit count.

---

<div class="post-metadata">

### Author: ![inchirah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inchirah/32/48145_2.png) [@inchirah](https://discuss.elastic.co/u/inchirah)
#### Post date: [June 12, 2020, 1:50pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/9 "2020-06-12T13:50:40Z")

</div>

you're right it's my mistake  
it works  
thank you so much

---

<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: [July 10, 2020, 2:02pm UTC](https://discuss.elastic.co/t/how-to-create-a-gauge-using-filter-ratio/236689/10 "2020-07-10T14:02:11Z")

</div>

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