# TSVB histogram and metric visualization doesnt match, when math operation is used

**URL:** <https://discuss.elastic.co/t/tsvb-histogram-and-metric-visualization-doesnt-match-when-math-operation-is-used/283819>\
**Category:** Kibana\
**Created:** [September 9, 2021, 9:15pm UTC](https://discuss.elastic.co/t/tsvb-histogram-and-metric-visualization-doesnt-match-when-math-operation-is-used/283819 "2021-09-09T21:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [September 9, 2021, 9:15pm UTC](https://discuss.elastic.co/t/tsvb-histogram-and-metric-visualization-doesnt-match-when-math-operation-is-used/283819/1 "2021-09-09T21:15:54Z")

</div>

Hi, I got two visualizations with the same math aggregation

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/b/8bb0d0e894cbed08ea44e5f5f074a62e7ccf1f81.png)

one is an histogram and the other a metric visualization.

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

but the value showed in the metric viz, doesnt match the max on the histogram.

why this happen?

---

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [September 10, 2021, 4:06pm UTC](https://discuss.elastic.co/t/tsvb-histogram-and-metric-visualization-doesnt-match-when-math-operation-is-used/283819/2 "2021-09-10T16:06:01Z")

</div>

So, in the picture below, the blue line represents the sum of the four metrics

```auto
params.tc + params.tm + params.cc + params.cm

```

![problema](https://us1.discourse-cdn.com/elastic/original/3X/b/9/b9e159033fb8f41f88925c6976b1f3e7d4cc07b0.png)

So I think that I have to separate every bucket and then find the bucket with higher value, something like this:

```auto
max(bucket-with-higher-value)

```

but I dont know what operation I have to do to acomplish that, please help.

---

<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:** [October 8, 2021, 4:06pm UTC](https://discuss.elastic.co/t/tsvb-histogram-and-metric-visualization-doesnt-match-when-math-operation-is-used/283819/3 "2021-10-08T16:06:15Z")

</div>

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