Influxql Division

Hello. Please, can you help me with below syntax. I’m getting a bit crazy with that.

Select a, b, a / b from (SELECT (last(“EvapEnergy_kWh_Acumulado”) - first(“EvapEnergy_kWh_Acumulado”)) as “a” FROM Girona WHERE (“Ubicacion” = ‘U001’) AND $timeFilter), (SELECT (last(“v”) - first(“v”)) as “b” FROM “Girona” WHERE “TipodeDato” = ‘ENERGIA_ACTIVA_TOTAL’ AND “Ubicacion” = ‘U001’ AND $timeFilter)

a returns 1120.63
b returns 565.52

Why the division isn’t returning any value?, what I’m doing wrong.
I’m running that from Grafana.

Thanks in advance.

Hello.

Have solved the issue adding a last in the division

Select last(a) / last (b) from (SELECT (last(“EvapEnergy_kWh_Acumulado”) - first(“EvapEnergy_kWh_Acumulado”)) as “a” FROM Girona WHERE (“Ubicacion” = ‘U001’) AND $timeFilter), (SELECT (last(“v”) - first(“v”)) as “b” FROM “Girona” WHERE “TipodeDato” = ‘ENERGIA_ACTIVA_TOTAL’ AND “Ubicacion” = ‘U001’ AND $timeFilter)

thanks

Hello @xterix,
We really appreciate you sharing your answer thank you!