# Show latest values for every unique value

**URL:** https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747
**Category:** Kibana
**Created:** [July 19, 2018, 1:58pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747 "2018-07-19T13:58:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![d\_s](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@d\_s](https://discuss.elastic.co/u/d_s)
#### Post date: [July 19, 2018, 1:58pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/1 "2018-07-19T13:58:02Z")

</div>

Hello! I have information for a set of machines and I am trying to display only the latest values for various fields for each unique serial number. So for ex if I have:  
serial# 1, temp: 100, color: red, date: 7/1/2018  
serial# 1, temp: 100, color: red, date: 7/2/2018  
serial# 1, temp: 100, color: red, date: 7/3/2018  
serial# 2, temp: 99, color: blue, date: 7/1/2018  
serial# 2, temp: 99, color: blue, date: 7/2/2018  
serial# 2, temp: 99, color: blue, date: 7/3/2018

then my table should only show:  
serial# 1, temp: 100, color: red, date: 7/3/2018  
serial# 2, temp: 99, color: blue, date: 7/3/2018

Since serial 1 and 2 are unique and the 3rd of July is the most recent date.  
Is this possible?

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [July 19, 2018, 8:38pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/2 "2018-07-19T20:38:32Z")

</div>

Hey, can do. Terms on serial number and then you're looking for the top hits metric with a size of 1 sorted on your date field for the other columns.

Top hits lets you grab n values in a bucket and take the min, max, concatenation, or sum of them. Sorting by date with a size of one will give us the most recent number.

---

<div class="post-metadata">

### Author: ![d\_s](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@d\_s](https://discuss.elastic.co/u/d_s)
#### Post date: [July 19, 2018, 9:34pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/3 "2018-07-19T21:34:46Z")

</div>

Thank you very much for the reply!  
This works but I was trying to make a table of the information. Do you happen to know if there is any way to do that (sorry I should have specified that in the original question).

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [July 19, 2018, 9:54pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/4 "2018-07-19T21:54:08Z")

</div>

Oh sorry about that, yes on more recent versions of Kibana. Which version of Kibana are you running? The data table visualization would have it at

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/3/232709d9ee435f8f3762682e0ee961112a2c9565.png)

---

<div class="post-metadata">

### Author: ![d\_s](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@d\_s](https://discuss.elastic.co/u/d_s)
#### Post date: [July 19, 2018, 10:01pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/5 "2018-07-19T22:01:43Z")

</div>

Thank you so much! That was exactly what I needed ^.^

---

<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 16, 2018, 10:05pm UTC](https://discuss.elastic.co/t/show-latest-values-for-every-unique-value/140747/6 "2018-08-16T22:05:47Z")

</div>

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