# Nested Group-by in data table

**URL:** <https://discuss.elastic.co/t/nested-group-by-in-data-table/225072>\
**Category:** Kibana\
**Created:** [March 25, 2020, 9:52pm UTC](https://discuss.elastic.co/t/nested-group-by-in-data-table/225072 "2020-03-25T21:52:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![srehorn](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@srehorn](https://discuss.elastic.co/u/srehorn)\
**Post date:** [March 25, 2020, 9:52pm UTC](https://discuss.elastic.co/t/nested-group-by-in-data-table/225072/1 "2020-03-25T21:52:11Z")

</div>

Hello,

I am trying to build a report layout that has more than one level of group nesting. This is a familiar report style with a top-level group label, then the next level grouping label, and then items listed under that.

Concretely, given data like this:

```
operation, object, day-of-week
buy, cheese, tuesday
sell, chips, thursday
buy, burrito, monday
buy, burrito, tuesday
cook, pasta, tuesday
cook, burrito, tuesday
sell, cheese, monday
buy, cheese, monday
sell, pasta, monday

```

I would like to see a formatted, nested report like this:

```
monday
    sell
       pasta
       burrito
       cheese
    buy
       burrito
       cheese
tuesday
    cook
        burrito
        pasta
    buy
        cheese
       burrito
   grate
       cheese
thursday
    sell
        chips

```

But not:

```
*monday*
    sell pasta
    sell burrito
    sell cheese
    buy burrito
    buy cheese
*tuesday*
    etc. 

```

The ultimate goal is to produce a nice, human-friendly printed PDF with fewer rows with repeated values.

Doing a row-split on terms lumps the data correctly, but I don't see how to display a list of rows under each group heading, possibly nested. I.e., I can send the result of my elastic query with repeated values in rows to "report generator" software and specify what columns I want to group by and it will list the rows in each sub group.

Thank you!

- scott r

(edit) PS: I'm using hosted Elastic from [Elastic.co](http://Elastic.co) if that's relevant

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [March 26, 2020, 2:22pm UTC](https://discuss.elastic.co/t/nested-group-by-in-data-table/225072/2 "2020-03-26T14:22:31Z")

</div>

Unfortunately this is not something that is possible right now in Kibana. The closest issue I know of that tracks this is the request to support [pivot tables](https://github.com/elastic/kibana/issues/5049), but I think this is actually a separate concept.

The closest issue I know of is actually one that I opened in EUI, but I think I will open a Kibana issue for this: [https://github.com/elastic/eui/issues/2705](https://github.com/elastic/eui/issues/2705)

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [March 26, 2020, 2:50pm UTC](https://discuss.elastic.co/t/nested-group-by-in-data-table/225072/3 "2020-03-26T14:50:18Z")

</div>

I've written up this feature in the context of Lens, which I work on: [https://github.com/elastic/kibana/issues/61470](https://github.com/elastic/kibana/issues/61470)

---

<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 23, 2020, 2:56pm UTC](https://discuss.elastic.co/t/nested-group-by-in-data-table/225072/4 "2020-04-23T14:56:40Z")

</div>

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