Transformations: Merge, but keep label

Hi,

I want to combine data queries from two data sources (both times Prometheus) and have the SUM of both. This in principle works nicely using the Merge transformation.

However, I would need to have one label / attribute respected, which is the region. This gets lost with Merge. I tried Group By transformation, but couldn’t get it running (and would have to hardcode regions, which is something that additionally changes).

Do you have a suggestion for me how to get the sum of both results per region?

Thanks
Steffen

Thanks to an awesome colleague, I was now able to solve this - using Expressions :star_struck:

  • Ensure that both series have the same label (as in my example {{region}}).
  • Use the second button on the bottom + Expression to add a Math expression $A + $B. Give that time series the name SUM.
  • Hide the two “source” time series using the eye icon
  • Rename the field and remove the SUM prefix.

That’s it #grafanalove

Math expression:

Polish series name: