# How to display the last date on a grouping set

**URL:** <https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854>\
**Category:** Kibana\
**Created:** [April 12, 2023, 3:18pm UTC](https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854 "2023-04-12T15:18:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FTOR](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@FTOR](https://discuss.elastic.co/u/FTOR)\
**Post date:** [April 12, 2023, 3:18pm UTC](https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854/1 "2023-04-12T15:18:51Z")

</div>

Hello, I am working on a dashboard, and I would like to show the last date on a grouping set.  
I take the kibana\_sample\_data\_ecommerce as example. Attachedn an example of row part.

 ![row_eCommerce](https://us1.discourse-cdn.com/elastic/original/3X/3/a/3afa48b1bb4cca90c110508207291938ca34df80.png)  
I would like to group by product\_id, take the last date of each group and then the last date of the hole grouping set. You will find on the aggregation images 1 and 2 what I did. I could only group by product\_id and take the take the last date of each bucket.  
 ![aggregation1](https://us1.discourse-cdn.com/elastic/original/3X/1/8/185d10fbb5e1b51c4231dde4a6bfc24486be8d94.png)  
 ![aggregation2](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a93a7726075eedaf5540d5080ad9a98635a8b6d.png)

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [April 15, 2023, 4:27am UTC](https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854/2 "2023-04-15T04:27:17Z")

</div>

Wouldn't this work? If you replace `FlightTimeMin` with `order_date` and `carrier` with `product_id` it should be pretty much the same thing.

 ![tsvb](https://us1.discourse-cdn.com/elastic/original/3X/9/d/9d64b0a19db84421464f22c49ea584b349300b71.png)

---

<div class="post-metadata">

**Author:** ![FTOR](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@FTOR](https://discuss.elastic.co/u/FTOR)\
**Post date:** [April 17, 2023, 2:45pm UTC](https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854/3 "2023-04-17T14:45:02Z")

</div>

> [@Marius\_Dragomir](#):
>
> `product_id`

Hello, thank you for your response. I tried this solution, but I got the last value for each product\_id. I would like to have the last date for all this grouping set. And I couldn't change the Aggregate with. It proposes only concatenate

 ![tophit](https://us1.discourse-cdn.com/elastic/original/3X/3/4/349d694c98b49315581de5173920288d78833f60.png)

---

<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:** [May 15, 2023, 2:45pm UTC](https://discuss.elastic.co/t/how-to-display-the-last-date-on-a-grouping-set/329854/4 "2023-05-15T14:45:37Z")

</div>

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