# Can i use derived value in histogram aggregation?

**URL:** <https://discuss.elastic.co/t/can-i-use-derived-value-in-histogram-aggregation/95201>\
**Category:** Elasticsearch\
**Created:** [July 31, 2017, 1:59pm UTC](https://discuss.elastic.co/t/can-i-use-derived-value-in-histogram-aggregation/95201 "2017-07-31T13:59:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaibhav\_goel](https://avatars.discourse-cdn.com/v4/letter/v/50afbb/32.png) [@vaibhav\_goel](https://discuss.elastic.co/u/vaibhav_goel)\
**Post date:** [July 31, 2017, 1:59pm UTC](https://discuss.elastic.co/t/can-i-use-derived-value-in-histogram-aggregation/95201/1 "2017-07-31T13:59:02Z")

</div>

GET urza/order/\_search  
{  
"size": 0,  
"aggs": {  
"by\_user": {  
"terms": {  
"field": "userId.keyword"  
},  
"aggs": {  
"total\_cost": {  
"sum": {  
"field": "subtotalPrice"  
}  
}  
}  
}  
}  
}

Now i want to apply histogram aggregation on total cost, Is this possible ??

---

<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 28, 2017, 1:59pm UTC](https://discuss.elastic.co/t/can-i-use-derived-value-in-histogram-aggregation/95201/2 "2017-08-28T13:59:42Z")

</div>

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