# Can some one help please: sum of the field by filtering in transforms not working

**URL:** <https://discuss.elastic.co/t/can-some-one-help-please-sum-of-the-field-by-filtering-in-transforms-not-working/244301>\
**Category:** Elasticsearch\
**Created:** [August 9, 2020, 11:16am UTC](https://discuss.elastic.co/t/can-some-one-help-please-sum-of-the-field-by-filtering-in-transforms-not-working/244301 "2020-08-09T11:16:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjilinga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anjilinga/32/86010_2.png) [@anjilinga](https://discuss.elastic.co/u/anjilinga)\
**Post date:** [August 9, 2020, 11:16am UTC](https://discuss.elastic.co/t/can-some-one-help-please-sum-of-the-field-by-filtering-in-transforms-not-working/244301/1 "2020-08-09T11:16:47Z")

</div>

Hi,

I am trying to create transform with the scenario, grouping by every 15 mins and aggregation should be like as below.

Getting the count of the records for each filter. but not able to perform Sum or max on the filtered records.  
aggs on filtered records not considering in transform script and deleting automatically from script. can some one help please.

"aggregations" :{  
"TotalAgentReady" :{  
"filter": {  
"bool": {  
"must": [  
{  
"term": {  
"CallActionName": "READY\_COMPLETE"  
}  
}  
]  
}  
},  
"aggs": {  
"TotalAgentReadyTime": {  
"sum": {  
"field": "Duration"  
}  
}  
}  
},  
"TotalAgentNotReady" :{  
"filter": {  
"bool": {  
"must": [  
{  
"term": {  
"CallActionName": "NOTREADY\_COMPLETE"  
}  
}  
]  
}  
},  
"aggs": {  
"TotalAgentNotReadyTime": {  
"sum": {  
"field": "Duration"  
}  
}  
}  
},  
"TotalAgentLoggedIn" :{  
"filter": {  
"bool": {  
"must": [  
{  
"term": {  
"CallActionName": "SESSION\_COMPLETE"  
}  
}  
]  
}  
},  
"aggs": {  
"TotalAgentLoggedInTime": {  
"sum": {  
"field": "Duration"  
}  
}  
}  
}

}

---

<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:** [September 6, 2020, 11:16am UTC](https://discuss.elastic.co/t/can-some-one-help-please-sum-of-the-field-by-filtering-in-transforms-not-working/244301/2 "2020-09-06T11:16:51Z")

</div>

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