Hi,

I'm trying to graph the sum of top hits (cost) per company but I'm not getting the desired results.

The data looks like this

```
2018-1-19
Product: A | total_cost: 25 | company: A
Product: B | total_cost: 50 | company: A
Product: C | total_cost: 100 | company: B
Product: D | total_cost: 200 | company: B
2018-1-20
Product: A | total_cost: 50 | company: A
Product: B | total_cost: 100 | company: A
Product: C | total_cost: 200 | company: B
Product: D | total_cost: 400 | company: B
2018-1-21
Product: A | total_cost: 100 | company: A
Product: B | total_cost: 200 | company: A
Product: C | total_cost: 300 | company: B
Product: D | total_cost: 500 | company: B
Product: C | total_cost: 200 | company: B
```

The `total_cost`

is the SUM of the total_cost so far so when I create my graphs I need to get the top hit for each product, so I have the latest values for each product, and then SUM the latest value for each product.

I then want to create a term value for the company so I get the SUM of the latest value for `total_cost`

and a date histogram set to month so I get the SUM of the latest value for all products combined per month.

I'm failing to get the SUM part working. Is there any way to do this in Kibana?