# Mathematically combine multiple prom metrics with matching labels

Hy!

I have 2 prom metrics `temperature` and `humidity`. Both of these have a label `sensor` (like “livingroom”, “kitchen” etc. in them).

Can I use any features in grafana to calculate a heat index (for a dummy example something like `4 + 3*temperature + 4*humidity - 2.5*temperature*humidity`, but the actual equation has 16 additions in it) for each temp-hum pair with matching sensor labels?

(I tried expressions, but as I understand it can’t handle if A and B has multiple series in them. I tried transformations, and I could successfully join A and B but I don’t have any freeform math input to work with those fields. It seems like a not so hard problem.)

can you not do the equation in your query?

You mean I should export the HI itself as a separate metrics? This is my plan B but ideally I would compute it live.

there are binary option transforms, but as binary implies, you can only use two fields at a time…

4 + 3temperature + 4humidity - 2.5temperaturehumidity

step 1: 3*temperature
step 2: 4 + result of step 1
step 3: 4 * humidity
step 4: result of step 2 + result of step 3
step 5: temp * humidity
step 6: 2.5 * step 5
etc.