# TSVB Markdown to show sum of variables

**URL:** <https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [May 29, 2022, 2:07pm UTC](https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878 "2022-05-29T14:07:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ely\_96](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ely_96/32/103816_2.png) [@Ely\_96](https://discuss.elastic.co/u/Ely_96)\
**Post date:** [May 29, 2022, 2:07pm UTC](https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878/1 "2022-05-29T14:07:37Z")

</div>

Hi guys,  
I have some problem with using markdown on TSVB: I would like to show a simple KPI (i.e: 1200) but this number should be a sum of 2 variables.  
In my documents I can select two filters:

1. variable\_1 (filter field AA == "hello") =\> 1000 docs
2. variable\_2 (filter field BB == "hi") =\> 200 docs.

In my markdown I would like to show 1200 as the sum of variable\_1 + variable\_2. Do you know if it's possible? I'm trying to use also Vega... but it's a little bit complicated. Please help me ☹

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [May 29, 2022, 2:46pm UTC](https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878/2 "2022-05-29T14:46:05Z")

</div>

Hi @Ely_96 Depending on what version you are on I think you can do this pretty easy in Lens with a Metric and a Formula

count(kql='fieldAA: "hello" ') + count(kql='fieldBB : "hi" ')

Here is an example I did with some metrics fields  
You can change the Label Name,

Starting 8.1+ You can color etc....

 ![Screen Shot 2022-05-29 at 7.55.43 AM](https://us1.discourse-cdn.com/elastic/original/3X/a/a/aa582199b6ab425c98d959b64f5892d383818518.png)

 ![Screen Shot 2022-05-29 at 7.56.48 AM](https://us1.discourse-cdn.com/elastic/original/3X/d/9/d955cbc2736f9812f7766a4813201b147a148da6.png)

---

<div class="post-metadata">

**Author:** ![Ely\_96](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ely_96/32/103816_2.png) [@Ely\_96](https://discuss.elastic.co/u/Ely_96)\
**Post date:** [May 30, 2022, 7:50am UTC](https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878/3 "2022-05-30T07:50:24Z")

</div>

Hi @stephenb thank a lot for your help!! I'm using Kibana 7.16.2 and yes, I found Metric \> Formula (and it works fine). For me isn't important to set colors or background.

Thanks!!! 🙂

---

<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:** [June 27, 2022, 7:51am UTC](https://discuss.elastic.co/t/tsvb-markdown-to-show-sum-of-variables/305878/4 "2022-06-27T07:51:13Z")

</div>

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