# How to calculate Avg of a duration in Timelion

**URL:** https://discuss.elastic.co/t/how-to-calculate-avg-of-a-duration-in-timelion/189605
**Category:** Kibana
**Tags:** elastic-stack-graph
**Created:** [July 9, 2019, 5:54pm UTC](https://discuss.elastic.co/t/how-to-calculate-avg-of-a-duration-in-timelion/189605 "2019-07-09T17:54:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Karthik2411](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karthik2411](https://discuss.elastic.co/u/Karthik2411)
#### Post date: [July 9, 2019, 5:54pm UTC](https://discuss.elastic.co/t/how-to-calculate-avg-of-a-duration-in-timelion/189605/1 "2019-07-09T17:54:03Z")

</div>

I want to know the exact command for calculating the average of a duration. For now I used the following code to get the average. Wonder why is it showing me the count of the average but not the average itself

".es(index=crs-_,q="wapqos.component=MATS,Average wapqos.ResponseTime.response\_time\_duration:_"), .es(index=crs-_,q="wapqos.component=TEAMS,Average wapqos.ResponseTime.response\_time\_duration:_"),.es(index=crs-_,q="wapqos.component=TPGW,Average wapqos.ResponseTime.response\_time\_duration:_")"

 ![36%20AM](https://us1.discourse-cdn.com/elastic/original/3X/0/4/04705687ddd283a590fb28d394ae57af7da38bd0.png)

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [July 19, 2019, 10:14am UTC](https://discuss.elastic.co/t/how-to-calculate-avg-of-a-duration-in-timelion/189605/2 "2019-07-19T10:14:31Z")

</div>

you also need to add "metric=avg:name\_of\_field" to your queries.

---

<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: [August 16, 2019, 10:14am UTC](https://discuss.elastic.co/t/how-to-calculate-avg-of-a-duration-in-timelion/189605/3 "2019-08-16T10:14:33Z")

</div>

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