# Date first occurrence of latest value

**URL:** <https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557>\
**Category:** Kibana\
**Created:** [August 26, 2024, 2:03pm UTC](https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557 "2024-08-26T14:03:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apenootje](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@apenootje](https://discuss.elastic.co/u/apenootje)\
**Post date:** [August 26, 2024, 2:03pm UTC](https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557/1 "2024-08-26T14:03:58Z")

</div>

Hello, i like to have the date of the first occurence of the latest value.  
Is this possible?

I can use the latest value in metric but i like to have the date of the first occurence of this latest value

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [August 26, 2024, 5:40pm UTC](https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557/2 "2024-08-26T17:40:58Z")

</div>

Thanks for reaching out, @apenootje. You could first identify the max value using a Max aggregation in a Metric visualization to find the highest or most recent value. From there, you can create a data table or visualization for the first occurrence and add both visualizations to a single dashboard.

If this method doesn't work for you, I'd be interested in learning more about the context of what you are looking to accomplish and what you are expecting to see.

---

<div class="post-metadata">

**Author:** ![apenootje](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@apenootje](https://discuss.elastic.co/u/apenootje)\
**Post date:** [August 27, 2024, 11:16am UTC](https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557/3 "2024-08-27T11:16:32Z")

</div>

thx for the reply, want i now have is something like this in the logging:

environment, releasenumber,date  
prd, 1.0.2,aug 27 @ 13:08:00.001  
prd, 1.0.2,aug 25 @ 13:07:00.001  
prd, 1.0.2,aug 24 @ 13:05:00.001  
prd, 1.0.1,aug 23 @ 13:04:00.001  
prd, 1.0.1,aug 22 @ 13:02:00.001  
prd, 1.0.1,aug 22 @ 13:00:00.001

what i would like to see here is the latest value of releasenumber, in this case it is 1.0.2 and then also the date when it occured the first time, in this case aug 24 @ 13:05:00.001.  
I now have a lens metric where i can filter on the latest value, that is working but i would like to add the date of it to the dashboard, how can i do this?

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [August 27, 2024, 9:22pm UTC](https://discuss.elastic.co/t/date-first-occurrence-of-latest-value/365557/4 "2024-08-27T21:22:11Z")

</div>

Thanks for following up, @apenootje.

You could use the Min aggregation on the date field to find the earliest occurrence. Additionally, you could bucket aggregation, typically a terms aggregation on the release number field. Make sure to sort the release number field in descending order and limit the size to 1 only to show the latest release number.
