cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DQL combine values from two fields

stevene1900
Frequent Guest

How can I create new field called total_count which is the sum of values "processed" and "errors":

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

 

Thanks.

3 REPLIES 3

AravindhanV
Contributor

hi @stevene1900

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.

https://docs.dynatrace.com/docs/shortlink/aggregation-commands

Thanks

aravind

PacoPorro
Dynatrace Leader
Dynatrace Leader

what do you get if you add a new field total_count=processed+errors?

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
       processed_count = if(isNull(arraySum(processed)),0.00,else:arraySum(processed)),
       errors_count = if(isNull(arraySum(prefix1errors)),0.00,else:arraySum(prefix1errors))
|  fields
        processed_count,
        errors_count,
        total_count = processed_count + errors_count
|

Featured Posts