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

This product reached the end of support date on March 31, 2021.

Custom Metric Expression Assistance

Dynatrace Advisor
Dynatrace Advisor

Hey guys,

Just had a question around my expression structure for a custom metric I am working on. I would like to compare the average CPU vs the average memory of a server. If either the memory or CPU average is 90% or greater, then I want it to return the integer '10000'. Otherwise, I would like it to simply multiply the two metrics and return the result as an integer. I can get it to multiply the two together with no problems, but when I try to put in the conditional, i get a generic 'Fatal error' returned.

Here is my expression:

...expression=CASE WHEN [avgProc] > 45 THEN 10000 WHEN [avgMem] > 89 THEN 10000 ELSE [avgProc] * [avgMem]

Any assistance with this query would be appreciated. I realize this could be a WHEN-OR-THEN-ELSE expression, but I have not been able to get that to work either.


Matt Lewis


Hi Matt,

It seems you have forgotten to terminate the expression with the 'end'.

Please try the following expression:

...expression=CASE WHEN [avgProc]>45 THEN 10000 WHEN [avgMem]>89 THEN 10000 ELSE [avgProc]*[avgMem] end

Hey Tomasz,

Thanks for the suggestion, and apologies for taking so long to get a chance to test this. Have tried putting 'end' at the end of the line, but that has not seemed to fix the issue.

At the moment the error message looks like:

"SQL error: Incorrect syntax near the keyword 'THEN'"

I will attach my .properties file in case anyone else wants to give it a go on their system and have a play.



From reading the syntax rules for the CASE statement, it seems the expression in your attached .properties file has an extraneous THEN just after the ELSE keyword.

Hi Matt,

Luke is right. There shouldn't be any 'THEN' after 'ELSE'.

Please use the following formula

CVENT.Citrix.calculatedColumn.0.expression=CASE WHEN [avgProc] > 89 THEN 10000 WHEN [avgMem] > 89 THEN 10000 ELSE [avgProc] * [avgMem] end

Dynatrace Advisor
Dynatrace Advisor


Here is my .properties file for the metric I am trying to create. I have just added .txt to the end of the filename, as the uploader would not accept a file with the .properties suffix.