# Kibana: How to obtain the last value of a date field

**URL:** <https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [February 20, 2025, 1:14pm UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817 "2025-02-20T13:14:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![InesCM](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@InesCM](https://discuss.elastic.co/u/InesCM)\
**Post date:** [February 20, 2025, 1:14pm UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817/1 "2025-02-20T13:14:52Z")

</div>

Hi! I have an index with many documents per device and day.  
One of the fields is a date field called "latest\_device\_activity\_dt". Please note that this is not the field that the index is referred to, is a date field that shows relevant information about the device.

For instance, if I choose 1 week in my time picker and display the last values of my date field, I obtain something like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e06765e216be66c0dfa01b7ff41549703a953b35.png)

I want to display the last value from the most updated document. However, I cannot use "last value" as a quick function, because it does not allow me to operate on date fields. I can only plot a date histogram, but I don't want that, I just want the most recent date. In the example above, I just want to get the 2025-02-19 date value.

Do you know how I could obtain the most recent value of a date field?

Thank you!

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [February 20, 2025, 3:59pm UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817/2 "2025-02-20T15:59:28Z")

</div>

Hi @InesCM

have you defined any other row column by chance?

If you have only one row dimension and a single metric then you should have a simple table like that one:

 ![Screenshot 2025-02-20 at 16.58.23](https://us1.discourse-cdn.com/elastic/original/3X/8/f/8f5c2d4939b976cdb838f3dcbe7df09ebf16dc0d.png)

---

<div class="post-metadata">

**Author:** ![InesCM](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@InesCM](https://discuss.elastic.co/u/InesCM)\
**Post date:** [February 21, 2025, 6:54am UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817/3 "2025-02-21T06:54:28Z")

</div>

Hi Marco!

Thank you for your prompt reply!

I haven't configured any other metric... the problem is that the Metric menu does not allow me to use the quick function "Last value" on a date field, it tells me that it cannot be used in date fields:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f5b8f916adeda72b22a9b13fdd409ed582c25092.png)

In fact, if I choose the quick function "Last value" and then try to add any field, all the date fields are grayed out, because I cannot use it on date fields:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/6/9617966a8b44250e9486b7f69c17d29aec6bba79.png)

And if I try to force it in a formula, the error tells me that the type is incorrect:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/e/fe52d509eb0b4b6385759dbab24f587a6284a302.png)

Might the Kibana version be an issue here? I'm using Kibana 7.17.6.

Kind regards,  
Inés

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [February 21, 2025, 9:42am UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817/4 "2025-02-21T09:42:55Z")

</div>

Dates support for Last value has been added since Kibana 8.2.0 .

---

<div class="post-metadata">

**Author:** ![InesCM](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@InesCM](https://discuss.elastic.co/u/InesCM)\
**Post date:** [February 21, 2025, 10:17am UTC](https://discuss.elastic.co/t/kibana-how-to-obtain-the-last-value-of-a-date-field/374817/5 "2025-02-21T10:17:15Z")

</div>

Thank you, Marco! Understood!
