# How calculate trend in data table visualization

**URL:** <https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007>\
**Category:** Kibana\
**Created:** [October 10, 2019, 10:55am UTC](https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007 "2019-10-10T10:55:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleg\_Lowen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oleg_lowen/32/44168_2.png) [@Oleg\_Lowen](https://discuss.elastic.co/u/Oleg_Lowen)\
**Post date:** [October 10, 2019, 10:55am UTC](https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007/1 "2019-10-10T10:55:43Z")

</div>

Hello,

I'm executing thousands of tests on hourly basis in a CICD pipeline. Each Elasticsearch document is describing a test with fields (name, success, duration, etc).

I'm trying to figure out, how to calculate a trend of failing tests in a **data table visualisation** , so basically number of successive failed tests.

Example 1: test1.success field values over time: true, false, true, false, false ,false  
Result: 3, because there are 3 recent successive failed tests

Example 1: test1.success field values over time: true, false, true, false, false ,true  
Result: 0, because the most recent test was successful

For that I would somehow need to iterate over docs grouped by test.name.

Any idea how to accomplish this?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 17, 2019, 7:01pm UTC](https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007/2 "2019-10-17T19:01:01Z")

</div>

Hmm, I can't think of a way to get exactly what you want here, but what you _could_ do is calculate the average success rate over that last N number of hits, or for a given time range. Would that be helpful?

There might also be a way to do this in Canvas if you're interested in giving it a try.

---

<div class="post-metadata">

**Author:** ![Oleg\_Lowen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oleg_lowen/32/44168_2.png) [@Oleg\_Lowen](https://discuss.elastic.co/u/Oleg_Lowen)\
**Post date:** [October 28, 2019, 8:15am UTC](https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007/3 "2019-10-28T08:15:27Z")

</div>

Thanks for your reply @lukas

> what you _could_ do is calculate the average success rate over that last N number of hits

I do this already, but the other metric I asked for is still the desired solution. Thanks anyway 🙂

---

<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, 8:25am UTC](https://discuss.elastic.co/t/how-calculate-trend-in-data-table-visualization/203007/4 "2019-11-25T08:25:23Z")

</div>

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