# Data table bucket over multiple fields

**URL:** <https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234>\
**Category:** Kibana\
**Created:** [March 26, 2020, 3:55pm UTC](https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234 "2020-03-26T15:55:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigh/32/63376_2.png) [@craigh](https://discuss.elastic.co/u/craigh)\
**Post date:** [March 26, 2020, 3:55pm UTC](https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234/1 "2020-03-26T15:55:33Z")

</div>

Hi,

I have league game's linescores stored in an index. For each game, the team could be in either:

for Boston Bruin away games:  
linescore.teams.away.team.name: Boston Bruins

or for Boston Bruin home games:  
linescore.teams.home.team.name: Boston Bruins

ie for home games they are in latter, away former.

I can't figure out how to create a data table which lists the teams, and has 3 columns: Total Games, Home Games, Away Games. Simple count for each of those fields.

I can get it to show teams and the count of say away games by a count on one of those fields above. But how would I get the table to bucket up counts for when the team could be in either of those two fields?

thanks,  
craig

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [April 3, 2020, 6:46pm UTC](https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234/2 "2020-04-03T18:46:43Z")

</div>

Hi @craigh,  
I was able to create a data table along the lines of what you want using a TSVB Table visualization with filter ratios. I don't have your dataset but did it worked using the Flights sample data that comes with Kibana. You'll have to use your imagination here, but what I did is that I used the Carrier as your team name, and delayed and not delayed as your home and away conditions (both delay vs not delayed and home vs away are binary, it's either one or the other).  
I imaging you'd use the team's name as the 'Group by field". For the Filter Ratio aggregation, you could either use a combination of "home:true" and "home:false" as the numerators or "home:true" and "away: true".

Here's a screenshot as a reference for you and a link to the [Data Table docs](https://www.elastic.co/guide/en/kibana/7.4/data-table.html)

 ![Screen Shot 2020-04-03 at 11.38.22](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d6341872642d00b2db3d2dc7519128c6d05c2454.png)

Good luck!

---

<div class="post-metadata">

**Author:** ![craigh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigh/32/63376_2.png) [@craigh](https://discuss.elastic.co/u/craigh)\
**Post date:** [April 4, 2020, 12:59am UTC](https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234/3 "2020-04-04T00:59:18Z")

</div>

Thanks a lot for the help. I'll give it a shot.

Craig

---

<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 2, 2020, 12:59am UTC](https://discuss.elastic.co/t/data-table-bucket-over-multiple-fields/225234/4 "2020-05-02T00:59:23Z")

</div>

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