Sum aggregation along with Unique Count aggregation

Hi,

I have a query regarding Sum and Unique Count aggregations.

I have fields "Total", "ID", "Date".

"Date" "ID" "Total"
"2013-05-14 14:30:10.02" "1" "2000"
"2013-05-14 14:30:10.02" "1" "2000"
"2013-05-14 14:30:10.02" "1" "2000"
"2013-05-14 14:30:10.02" "1" "2000"
"2013-05-14 14:30:10.02" "2" "4000"
"2013-05-14 14:30:10.02" "2" "4000"
"2013-05-14 14:30:10.02" "2" "4000"
"2013-05-14 14:30:10.02" "4" "2000"
"2013-05-14 14:30:10.02" "4" "2000"
"2013-05-14 14:30:10.02" "4" "2000"

Here, I need sum(Total) based on the unique ID

Is there a way to do it in kibana???

Thanks,
Sanjay Reddy

Yes,

If you just want the data use the datatable visualization, in the metric have the sum of the total and in the buckets select split row by term and use the ID.

Hope that help.

-- Asaf.

Hi @asafyigal

Thanks for the quick reply :smile:

As the Total is repeating for the same ID, sum is varying. So, I need like this

Sum(ID=1) =2000 and not 8000
Sum(ID=2) = 4000 and not 12000
Sum(ID=4) = 2000 and not 6000

which means I need Sum(Unique Total) for Unique ID

Is it possible ???

@sanju1323 - Sure

Just use the average aggregation on the metric instead of sum - assuming they have the same value the average will give you what you want.

-- Asaf.

Thanks @asafyigal

That is fine. But I want this aggregation to be done on the Metrics because I have to perform another aggregations in Buckets.
So, I need average(Total) by ID in Metrics itself.

I have tried sum(Total) in one Metrics and unique(ID) in another metrics which gives me two different dimensions in the bar graph.