# Making a graph, based on the last entry of each group

**URL:** <https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646>\
**Category:** Kibana\
**Created:** [February 3, 2020, 3:19pm UTC](https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646 "2020-02-03T15:19:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amon](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Amon](https://discuss.elastic.co/u/Amon)\
**Post date:** [February 3, 2020, 3:19pm UTC](https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646/1 "2020-02-03T15:19:23Z")

</div>

Dear,

Each line in my database is giving me information about a tunnel, one of the column is calling tunnel\_status and has values "up" and "down" another column has the name "tunnel number" with values "tunnel 1",... "tunnel 8". What I want to do now is to create a graph which gives me the latest value of each tunnel. Preferable is an histogram.

Kind regards,  
Amon

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [February 3, 2020, 7:22pm UTC](https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646/2 "2020-02-03T19:22:36Z")

</div>

Hey @Amon, if you'd like to see the latest `tunnel_status` for each of the trains, we can't create a Histogram of this because `tunnel_status` is a string. We can however use the data table visualization to get you this information.

Using Dev Tools, we can create some sample data to play around with:

```auto
POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 1"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 1"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 2"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 2"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 3"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 3"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 4"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 4"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 5"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 5"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 6"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 6"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 7"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 7"
}

POST amon/_doc
{
  "@timestamp": "2020-02-01T00:00:00.000Z",
  "tunnel_status": "down",
  "tunnel_number": "tunnel 8"
}

POST amon/_doc
{
  "@timestamp": "2020-02-02T00:00:00.000Z",
  "tunnel_status": "up",
  "tunnel_number": "tunnel 8"
}

```

Using the following Data Table configuration, we are able to get the information you're looking for:

 ![Screen Shot 2020-02-03 at 11.22.19 AM](https://us1.discourse-cdn.com/elastic/original/3X/1/8/18b6e34d7067124a0a2a95af7c7395c910f8da7f.png)

---

<div class="post-metadata">

**Author:** ![Amon](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Amon](https://discuss.elastic.co/u/Amon)\
**Post date:** [February 4, 2020, 9:27am UTC](https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646/3 "2020-02-04T09:27:43Z")

</div>

Dear Brandon,

Thank you very much for your quick response. This is exactly where I was looking for!

Have a great day!

Kind regards,  
Amon

---

<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:** [March 3, 2020, 9:27am UTC](https://discuss.elastic.co/t/making-a-graph-based-on-the-last-entry-of-each-group/217646/4 "2020-03-03T09:27:49Z")

</div>

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