# How to make a master detail report in Kibana

**URL:** <https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468>\
**Category:** Kibana\
**Created:** [July 25, 2018, 2:04am UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468 "2018-07-25T02:04:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Ensslen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steven_ensslen/32/26984_2.png) [@Steven\_Ensslen](https://discuss.elastic.co/u/Steven_Ensslen)\
**Post date:** [July 25, 2018, 2:04am UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468/1 "2018-07-25T02:04:58Z")

</div>

I appreciate this isn't Kibana's usual use, but if I wanted to create a master-detail report in Kibana, how would I do so? By master detail report, I mean a data table style report where under each data row (perhaps showing totals by a large grouping, like country), there are a series of rows at a smaller level of aggregation (say by city) that show different data fields. Here is [an example in another tool](https://documentation.devexpress.com/XtraReports/4785/Creating-Popular-Reports/Creating-a-Master-Detail-Report-using-Detail-Report-Bands).

I've attempted this is vega, but I still haven't had any success with the [syntax for multi-level aggregations](https://discuss.elastic.co/t/format-for-multi-level-aggregation-in-vega/127193).

I appreciate any suggestions.

---

<div class="post-metadata">

**Author:** ![Steven\_Ensslen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steven_ensslen/32/26984_2.png) [@Steven\_Ensslen](https://discuss.elastic.co/u/Steven_Ensslen)\
**Post date:** [July 25, 2018, 8:11pm UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468/2 "2018-07-25T20:11:51Z")

</div>

Using the split table feature of data tables almost works for my master-detail requirement. There could be a prepared field or scripted field that included elements like field names, so that one prepared field had many sections like "Agent: Anne Client: Bruce". And totals could be enabled for the metrics displayed in the detail section.

I believe that data table based approaches can not aggregate fields other than the ones which appear in the detail section, as neither a prepared nor scripted field can have an aggregate in it.

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [July 26, 2018, 6:43pm UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468/3 "2018-07-26T18:43:54Z")

</div>

The chart you linked to would definitely be possible if each document represented a "sale" and looked something like this:

```json
{
  "category": "Beverages",
  "product": "Chai",
  "price": 6.00
}

```

Then, like you mention in your second comment, you could use a split data table, the metric would be the sum of `price` and the buckets would be "Split table: terms of `category`" then "Split rows: terms of `product`"

Without knowing what your data looks like I'm not sure how to adapt this example to your use case, but I hope that helps a little but. Maybe you can go into a bit more detail about what you mean by "I believe that data table based approaches can not aggregate fields other than the ones which appear in the detail section, as neither a prepared nor scripted field can have an aggregate in it."

---

<div class="post-metadata">

**Author:** ![Steven\_Ensslen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steven_ensslen/32/26984_2.png) [@Steven\_Ensslen](https://discuss.elastic.co/u/Steven_Ensslen)\
**Post date:** [July 27, 2018, 4:06am UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468/4 "2018-07-27T04:06:08Z")

</div>

I believe that the following is not possible in Kibana. For an index with two keywords and two integers make the following data table style visualisation. In the header section we have a terms aggregation on the first keyword with the sum of the first integer. In the detail section we have a terms aggregation on the second keyword with the sum of the second integer.

So if the data is

```
{ a: "de", b:"berlin",c: 1, d: 2}
{ a: "de", b:"berlin",c: 3, d: 4}
{ a: "fr", b:"paris",c: 5, d: 6}

```

The report is

```
de 4
----------
- berlin 6

fr 5
----------
- paris 6

```

I believe that nothing like this is simple example is possible in Kibana.

---

<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:** [August 24, 2018, 4:06am UTC](https://discuss.elastic.co/t/how-to-make-a-master-detail-report-in-kibana/141468/5 "2018-08-24T04:06:18Z")

</div>

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