# Is it possible to combine two datatable from multiple essql filters

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290>\
**Category:** Kibana\
**Created:** [December 1, 2020, 11:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290 "2020-12-01T23:39:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tangkalo](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tangkalo](https://discuss.elastic.co/u/tangkalo)\
**Post date:** [December 1, 2020, 11:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290/1 "2020-12-01T23:39:17Z")

</div>

Hi, I have a data source like below: -

TYPE VALUE  
A 123  
A 234  
B 890  
A 789  
B 085

I need to pull the latest record for each type i.e. there will be two rows in the result : -

A 123  
B 890

I think I cannot do it with elasticsearch sql(please correct me if I am wrong). If not, can I have two essql filters in my expression and somehow combine them? The two essql filters will be : -

SELECT TYPE, VALUE FROM SOURCE WHERE TYPE = A ORDER BY @timestamp DESC LIMIT 1

SELECT TYPE, VALUE FROM SOURCE WHERE TYPE = B ORDER BY @timestamp DESC LIMIT 1

Is it possible?

Thanks a lot in advance.

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [December 3, 2020, 1:49pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290/2 "2020-12-03T13:49:52Z")

</div>

Hi @tangkalo, since you've asked this question in #elastic-stack:kibana section, I assume you are using canvas and this is a question about visualizing your data?

I don't think it is possible to combine two data tables into a single table this way.  
As a presentation alternative, I'd suggest to create two separate canvas metric charts and configure each two display last values for its own type.

---

<div class="post-metadata">

**Author:** ![tangkalo](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tangkalo](https://discuss.elastic.co/u/tangkalo)\
**Post date:** [December 3, 2020, 3:11pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290/3 "2020-12-03T15:11:28Z")

</div>

> [@dosant](#):
>
> canvas metric charts

Thanks for the suggestion. Yes, it's in canvas. By metric charts, do you mean the Metric element?

On the other hand, I am also thinking of manually creating a table and populating it with customized values. I have been looking at Markdown element but haven't been able to find the syntax that allows me to create a table.

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [December 3, 2020, 3:23pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290/4 "2020-12-03T15:23:32Z")

</div>

> By metric charts, do you mean the Metric element?

Yes!

---

<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 31, 2020, 3:23pm UTC](https://discuss.elastic.co/t/is-it-possible-to-combine-two-datatable-from-multiple-essql-filters/257290/5 "2020-12-31T15:23:35Z")

</div>

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