# Pie chart - show last string value of two records with same ID

**URL:** <https://discuss.elastic.co/t/pie-chart-show-last-string-value-of-two-records-with-same-id/299614>\
**Category:** Kibana\
**Created:** [March 14, 2022, 12:22pm UTC](https://discuss.elastic.co/t/pie-chart-show-last-string-value-of-two-records-with-same-id/299614 "2022-03-14T12:22:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Polcar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakub_polcar/32/102998_2.png) [@Jakub\_Polcar](https://discuss.elastic.co/u/Jakub_Polcar)\
**Post date:** [March 14, 2022, 12:22pm UTC](https://discuss.elastic.co/t/pie-chart-show-last-string-value-of-two-records-with-same-id/299614/1 "2022-03-14T12:22:15Z")

</div>

Hello,

is there an option how to set up a pie chart to show count of last **string** values, but if there are two records with same ID, count only last one based on timestamp?

**Test records:**  
record 1: ID: 123, variable: "value\_1", timestamp: 14.3.2022@12:00  
record 2: ID: 123, variable: "value\_2", timestamp: 14.3.2022@13:00  
record 3: ID: 456, variable: "value\_3", timestamp: 14.3.2022@14:00

There will be **value\_2** and **value\_3** in a pie with count of 1.

I tried top hit, but it can be configured only for number, not string.

Thanks for any help.

---

<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:** [April 11, 2022, 12:22pm UTC](https://discuss.elastic.co/t/pie-chart-show-last-string-value-of-two-records-with-same-id/299614/2 "2022-04-11T12:22:29Z")

</div>

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