# TSVB markdown with conditional values

**URL:** <https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582>\
**Category:** Kibana\
**Created:** [July 17, 2023, 3:45pm UTC](https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582 "2023-07-17T15:45:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hkhalil](https://avatars.discourse-cdn.com/v4/letter/h/e9bcb4/32.png) [@hkhalil](https://discuss.elastic.co/u/hkhalil)\
**Post date:** [July 17, 2023, 3:45pm UTC](https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582/1 "2023-07-17T15:45:42Z")

</div>

Hi,

We're looking to create in our dashboard a markdown using the TSVB control type. Our dashboard has controls for filtering purposes.

We would like the markdown to display different predetermined numerical values based on the user's selections in our dashboard's controls.

Is this possible ? I looked at the handlebars documentation and I don't see any built-in support for conditional comparisons (i.e.: if user selects 'X' in control A and 'Y' in control B, then display predetermined numerical value 'Z' in the markdown).

If it's not possible, what alternatives do we have ? I was thinking of maybe exposing those numerical values in Elastic documents. User selection in the controls would filter the returned documents, ensuring we fetch those with the numerical values we want displayed in the markdown.

Thanks

---

<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 18, 2023, 2:20pm UTC](https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582/2 "2023-07-18T14:20:57Z")

</div>

Markdown as a visualization is not really made to be filtered. Your alternative could work, but not with a markdown, but with a saved search that will only show the document that matches your values.

---

<div class="post-metadata">

**Author:** ![hkhalil](https://avatars.discourse-cdn.com/v4/letter/h/e9bcb4/32.png) [@hkhalil](https://discuss.elastic.co/u/hkhalil)\
**Post date:** [July 18, 2023, 4:25pm UTC](https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582/3 "2023-07-18T16:25:35Z")

</div>

That's what I had in mind when suggesting my alternative, I believe it could work with a markdown ?

* * *

We have documents with fields **F1** and **F2**.

A control on our dashboard filters **F1**.

For all documents with value **A** for **F1** , **B** would be returned for **F2**.

For all documents with value **C** for **F1** , **D** would be returned for **F2**.

_etc._

**F2** holds essentially a constant value for all documents matching a particular value for **F1**.

The markdown would be configured to have a variable obtained through a "Top Hit" aggregation of 1 on **F2**.

The markdown would display that variable.

* * *

You mention using a saved search, how exactly would that work in the context of displaying text to the user ? (if markdowns can't be used)

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:** [August 15, 2023, 4:26pm UTC](https://discuss.elastic.co/t/tsvb-markdown-with-conditional-values/338582/4 "2023-08-15T16:26:10Z")

</div>

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