# Handlebar Helpers in TSVB Markdown

**URL:** <https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [March 29, 2022, 4:49pm UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991 "2022-03-29T16:49:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirubanandhan](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@Kirubanandhan](https://discuss.elastic.co/u/Kirubanandhan)\
**Post date:** [March 29, 2022, 4:49pm UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/1 "2022-03-29T16:49:34Z")

</div>

Hi Team,

I want to add some Handlebar helpers like below. So that i can use it in TSVB Markdown. I need to use it for calculate difference between the two count values. @tsullivan @devon.thomson @bhavyarm Help required.

```auto
Handlebars.registerHelper('difference', function (val1, val2) {
    return val1-val2;
})

```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [March 30, 2022, 10:58am UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/2 "2022-03-30T10:58:21Z")

</div>

It's not possible to add custom helpers to markdown. However, to calculate a difference you should be able to use the "math" aggregation in the data tab

---

<div class="post-metadata">

**Author:** ![Kirubanandhan](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@Kirubanandhan](https://discuss.elastic.co/u/Kirubanandhan)\
**Post date:** [March 30, 2022, 4:04pm UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/3 "2022-03-30T16:04:18Z")

</div>

> [@flash1293](#):
>
> markd

Math wont work between Layers.. I want show count of this Month , Count of Previous Month and Difference between counts. Can you pls help on it

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [March 31, 2022, 8:13am UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/4 "2022-03-31T08:13:55Z")

</div>

Good point, that's not possible in TSVB. Lens formula allows to do calculations across different time ranges - see [Analyze time series data | Kibana Guide [8.1] | Elastic](https://www.elastic.co/guide/en/kibana/current/create-a-dashboard-of-panels-with-ecommerce-data.html#compare-time-as-percent)

However, you can't use it together with Markdown yet - if a regular metric vis works for you too then that might be an option.

---

<div class="post-metadata">

**Author:** ![Kirubanandhan](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@Kirubanandhan](https://discuss.elastic.co/u/Kirubanandhan)\
**Post date:** [March 31, 2022, 9:02am UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/5 "2022-03-31T09:02:35Z")

</div>

If i do math calculations like {{ subtract previous\_count thismonth\_count}} in Markdown handlers it would be better.

---

<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:** [April 28, 2022, 9:02am UTC](https://discuss.elastic.co/t/handlebar-helpers-in-tsvb-markdown/300991/6 "2022-04-28T09:02:51Z")

</div>

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