# Create a table & graph that takes only the last value and puts it in the table or graph in Kibana

**URL:** https://discuss.elastic.co/t/create-a-table-graph-that-takes-only-the-last-value-and-puts-it-in-the-table-or-graph-in-kibana/244392
**Category:** Kibana
**Tags:** kql-kibana-query-language
**Created:** [August 10, 2020, 11:27am UTC](https://discuss.elastic.co/t/create-a-table-graph-that-takes-only-the-last-value-and-puts-it-in-the-table-or-graph-in-kibana/244392 "2020-08-10T11:27:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tamirs](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@tamirs](https://discuss.elastic.co/u/tamirs)
#### Post date: [August 10, 2020, 11:27am UTC](https://discuss.elastic.co/t/create-a-table-graph-that-takes-only-the-last-value-and-puts-it-in-the-table-or-graph-in-kibana/244392/1 "2020-08-10T11:27:26Z")

</div>

I am looking to replace our Splunk SIEM or add another platform, our purpose is to send diagnostics data from our instances and filter it out.

most of the information will be sent in JSON format,

I am gathering information on an hourly basis in JSON format. the information checks for specific OS values in an array  
for example:

`"os": [{ "id": "Windows 7", "count": 100 } , { "id": "Windows 8", "count": 30 }]`

the only thing that might change is the count value.

I am trying to create a table & graph that takes only the last value and puts it in the table.  
In Splunk, I could create an average using the "span" command to have an average for a predefined time.

So even though the table or graph is showing information in the last week, every timestamp averages the data from the last 30minutes.

I couldn't find a way to do it in Kibana, or any documentation regarding it.

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [August 12, 2020, 5:11pm UTC](https://discuss.elastic.co/t/create-a-table-graph-that-takes-only-the-last-value-and-puts-it-in-the-table-or-graph-in-kibana/244392/2 "2020-08-12T17:11:00Z")

</div>

You can use the [top hits aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html) to obtain the latest value while running aggregations.

In the example below, I added `top hits` metric to add the latest value to the table

 ![Screen Shot 2020-08-12 at 11.10.00 AM](https://us1.discourse-cdn.com/elastic/original/3X/0/9/093495d3047aa7c1357cb012329dbe24075db35b.png)

---

<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: [September 9, 2020, 5:11pm UTC](https://discuss.elastic.co/t/create-a-table-graph-that-takes-only-the-last-value-and-puts-it-in-the-table-or-graph-in-kibana/244392/3 "2020-09-09T17:11:00Z")

</div>

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