# DQL  combine values from two fields

**URL:** <https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed\
**Created:** [March 31, 2025, 11:13pm UTC](https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981 "2025-03-31T23:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevene1900](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@stevene1900](https://community.dynatrace.com/u/stevene1900)\
**Post date:** [March 31, 2025, 11:13pm UTC](https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981/1 "2025-03-31T23:13:57Z")

</div>

How can I create new field called total\_count which is the sum of values “processed” and “errors”:

fields  
&nbsp; &nbsp; processed = if(isNull(arraySum(processed)),0.00,else:arraySum(processed)),  
&nbsp; &nbsp; errors = if(isNull(arraySum(prefix1errors)),0.00,else:arraySum(prefix1errors)

Thanks.

---

<div class="post-metadata">

**Author:** ![AravindhanV](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@AravindhanV](https://community.dynatrace.com/u/AravindhanV)\
**Post date:** [April 1, 2025, 6:39am UTC](https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981/2 "2025-04-01T06:39:49Z")

</div>

hi&nbsp;[@stevene1900](https://community.dynatrace.com/user/71653),

Either fieldsSummary or Converting into timeseries would help you to achieve this. you can refer the Aggregation Commands section from the document would help you i hope.

> **[DQL aggregation commands](https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/commands/aggregation-commands)**
>
> DQL aggregation commands

Thanks

---

<div class="post-metadata">

**Author:** ![PacoPorro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pacoporro/32/36087_2.png) [@PacoPorro](https://community.dynatrace.com/u/PacoPorro)\
**Post date:** [April 1, 2025, 10:29am UTC](https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981/3 "2025-04-01T10:29:06Z")

</div>

what do you get if you add a new field total\_count=processed+errors?

---

<div class="post-metadata">

**Author:** ![stevene1900](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@stevene1900](https://community.dynatrace.com/u/stevene1900)\
**Post date:** [April 1, 2025, 4:13pm UTC](https://community.dynatrace.com/t/dql-combine-values-from-two-fields/50981/4 "2025-04-01T16:13:30Z")

</div>

I was getting error that “errors” field does not exist. The problem I was running into ultimately was the possibility of null values, which is what “errors” was while “processed” was not null.

Thanks for pushing me in the right direction and glad as easy as just adding the values, which is something that I had tried before but was getting thrown off by the error.

I ended up creating the fields higher up, so that “errors\_count” (formerly just “errors”) ended up as 0 instead of null.:

| fieldsadd  
&nbsp; &nbsp; &nbsp; &nbsp;processed\_count = if(isNull(arraySum(processed)),0.00,else:arraySum(processed)),  
&nbsp; &nbsp; &nbsp; &nbsp;errors\_count = if(isNull(arraySum(prefix1errors)),0.00,else:arraySum(prefix1errors))  
|&nbsp; fields  
&nbsp; &nbsp; &nbsp; &nbsp; processed\_count,  
&nbsp; &nbsp; &nbsp; &nbsp; errors\_count,  
&nbsp; &nbsp; &nbsp; &nbsp; total\_count = processed\_count + errors\_count  
|
