# How to set moving average in TSVB

**URL:** <https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996>\
**Category:** Kibana\
**Created:** [November 22, 2019, 1:34am UTC](https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996 "2019-11-22T01:34:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [November 22, 2019, 1:34am UTC](https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996/1 "2019-11-22T01:34:59Z")

</div>

I am trying to set moving average that set in timelion in TSVB.  
window is the time unit in timelion, what is the unit of window in TSVB?  
What if I want to set window to yesterday?

timelion query:  
.es(index=indexname, timefield=@timestamp).movingaverage(window=1d,  
position=left).lines(2).color(#ffc952).label('average traffic of last day')

TSVB setting:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/7/17da72cb506df4a31b746aacf7320f2c0f890444.png)

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [November 22, 2019, 4:59pm UTC](https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996/2 "2019-11-22T16:59:26Z")

</div>

Hey @Yungyoung_Ok, which "interval" were you using in Timelion? If you were using "one hour", then in TSVB you'd set the "interval" to `1h` in TSVB:

 ![03%20AM](https://us1.discourse-cdn.com/elastic/original/3X/f/3/f3ca88867aaa08293bb8f30bd192b12723560e57.png)

and the window size to `24`:

 ![10%20AM](https://us1.discourse-cdn.com/elastic/original/3X/c/a/ca79eb5a668f74adc6e552334adc3f9ff68ad622.png)

---

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [November 25, 2019, 2:29am UTC](https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996/3 "2019-11-25T02:29:40Z")

</div>

thanks a lot!

---

<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:** [December 23, 2019, 2:29am UTC](https://discuss.elastic.co/t/how-to-set-moving-average-in-tsvb/208996/4 "2019-12-23T02:29:40Z")

</div>

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