# % calculation doesn't seem correct

**URL:** <https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590>\
**Category:** Kibana\
**Created:** [February 26, 2021, 9:58am UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590 "2021-02-26T09:58:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivekshukla](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vivekshukla](https://discuss.elastic.co/u/vivekshukla)\
**Post date:** [February 26, 2021, 9:58am UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/1 "2021-02-26T09:58:05Z")

</div>

Hi Team,

I drew a Metric using TSVB by following the excellent article [How to display data as a percentage in Kibana visualizations | Elastic Blog](https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations)  
So far so good.  
But when I am calculating the % manually, its no where correct.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/a/9ada5ab31c7280e9a4116ce11e5bca106456e621.png)

The query which I used:  
For **Numerator** -\>

```auto
eventName.keyword :UPLOAD_STAGE and payload.document.status.keyword:VALID_DOCUMENT and payload.document.type.keyword:Passport

```

I received a count as **55** in discover tab

For **Denominator** -\>

```auto
eventName.keyword :RETRIEVAL_STAGE

```

I received a count as **926** in Discover tab

So if I calculate the percentage manually, it comes as **5.9**

However Kibana is showing as _ **68%** _.

I am bit confused. Is there anything wrong with my approach?  
Why am I having different percentage calculation result?  
Looking forward to help me understand the mistakes.  
Thank you!

---

<div class="post-metadata">

**Author:** ![gmmorris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmorris/32/72624_2.png) [@gmmorris](https://discuss.elastic.co/u/gmmorris)\
**Post date:** [February 26, 2021, 4:53pm UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/2 "2021-02-26T16:53:26Z")

</div>

Hi Vivek,  
This isn't quite my area, but my understanding is that the most likely reason is your Data Timerange mode.  
If you're using anything but the time series chart type, such as metric, you probably need to choose [Entire Timerange](https://www.elastic.co/guide/en/kibana/master/TSVB.html#_visualization_options).

---

<div class="post-metadata">

**Author:** ![vivekshukla](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vivekshukla](https://discuss.elastic.co/u/vivekshukla)\
**Post date:** [February 26, 2021, 5:25pm UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/3 "2021-02-26T17:25:30Z")

</div>

@gmmorris : No worries. I have just found the solution.  
**Lower case "and"** was creating the problem in Numerator and Denominator.

But I believe case shouldn't matter. Do you agree with me?  
If yes, then we can ask for improvement.

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [March 1, 2021, 8:57am UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/4 "2021-03-01T08:57:28Z")

</div>

Hey @vivekshukla! Which version do you use? On 7.10 we changed the filter ratio to also support KQL in order to avoid this kind of confusion. Until then, it only supported Lucene. [KQL support in filter ratio in TSVB · Issue #67503 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/67503)

---

<div class="post-metadata">

**Author:** ![vivekshukla](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vivekshukla](https://discuss.elastic.co/u/vivekshukla)\
**Post date:** [March 1, 2021, 11:27am UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/5 "2021-03-01T11:27:34Z")

</div>

@Stratoula_Kalafateli Yeah,I am using 7.4 and that might be the reason.

---

<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 29, 2021, 11:28am UTC](https://discuss.elastic.co/t/calculation-doesnt-seem-correct/265590/6 "2021-03-29T11:28:20Z")

</div>

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