Create a new value depending on the comparison of two existing

  • What Grafana version and what operating system are you using?
    8.3.1
  • What are you trying to achieve?
    Create a new value depending on the comparison of two existing ones. For example:
    if ($A > 0)and($A < $B) then $C=“Degraded”
    if ($A = $B) then $C=“Up”
    if ($A = 0) then $C=“Down”
  • How are you trying to achieve it?
    I have 2 queries to prometheus:

    and Merge Transformation.
    So as a result I have table like:
Time					| deployment | Value #A	| Value #B
2022-08-17 13:09:26.000	| service1	 | 1		| 2			
2022-08-17 13:09:26.000	| service2	 | 2		| 2			
2022-08-17 13:09:26.000	| service3	 | 0		| 2		
  • What happened?
    When I try to add simple Math expression:
    $A + $B
    or with Reduce A, Reduce B and after that $A + $B
    in my table I see “No data”.
    I understand that is not condition. But even this simple operation doens’t work in my case.
  • What did you expect to happen?
    I want to get next table:
    Screenshot 2022-08-17 132406

Can somebody help with advice how to achieve my need?