# Visualize the last value

**URL:** <https://discuss.elastic.co/t/visualize-the-last-value/290641>\
**Category:** Kibana\
**Created:** [December 1, 2021, 8:47am UTC](https://discuss.elastic.co/t/visualize-the-last-value/290641 "2021-12-01T08:47:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlos\_gomez\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_gomez_gomez/32/89007_2.png) [@carlos\_gomez\_gomez](https://discuss.elastic.co/u/carlos_gomez_gomez)\
**Post date:** [December 1, 2021, 8:47am UTC](https://discuss.elastic.co/t/visualize-the-last-value/290641/1 "2021-12-01T08:47:56Z")

</div>

Hi.

I'm trying to make a visualitzacion of an scripted field. The value of the scripted field only can be 1 or 0 is like a boolean. I want to visualice a line graph. I have two questions about that.

- It its possible to make a visualitzación of the last element witout agregation ? I don't wanto to make average, sum or other agregation, i only want to show the value.

- It is possible to visualize the same value until another value arrives ? For example, at 9:00 it takes me a 1, and at 12:00 a 0. I want the 1 to stay until a 0 arrives, representing for example that a parking spot is occupied. Now I'm using top hit, but I think that could be another better option.

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

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

Thank you so much.

---

<div class="post-metadata">

**Author:** ![majagrubic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majagrubic/32/74459_2.png) [@majagrubic](https://discuss.elastic.co/u/majagrubic)\
**Post date:** [December 1, 2021, 9:57am UTC](https://discuss.elastic.co/t/visualize-the-last-value/290641/2 "2021-12-01T09:57:09Z")

</div>

Hi, which version of Kibana are you using? You can easily plot the last value with `Lens`. Go to Lens \> Metric \> Last Value \> \<your\_field\>.

If you want to stick to Metric visualization, you can do it by:

```auto
Metric Aggregation: Top Hit
Field: your_field
Aggregate with: concatenate
Size: 1
Sort on: @timestamp
Order: Descending

```

This should give you the last value.

---

<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 29, 2021, 9:57am UTC](https://discuss.elastic.co/t/visualize-the-last-value/290641/3 "2021-12-29T09:57:55Z")

</div>

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