# SingleStat Math alternative?

Since my latest update i’m getting a yellow ! on my dashboard saying that the Angular plugin used by SingleStat Math will be depreciated. On the website of grafana it says as a solution
“Migrate - Browse included visualizations and plugins catalog for potential alternatives.”

Since this isn’t very helpfull i was wondering if someone could help me solve this? I’m currently combining (+) 2 values from a influxdb query

I guess `Stat` panel + expression/transformation

1 Like

I tried to change it, but i’m getting different results?
Any idea what i’m doing wrong? the timefilter for both is “today so far”

Old: SingleStat Math:
expression: export + net (this gives 7.8kWh in this example)
queries:
export: SELECT sum(“kWh”) FROM “iotawatt” WHERE (“ct” = ‘Export’) AND \$timeFilter GROUP BY time(\$__interval) fill(null)
net: SELECT sum(“kWh”) FROM “iotawatt” WHERE (“ct” = ‘EandiskWh’) AND \$timeFilter GROUP BY time(\$__interval) fill(null)

alternative: Stat ==> this gives 7.1 kWh ?
Query: so the export is A and the net is B
SELECT (mean(“A”) + mean(“B”)) FROM ( SELECT sum(“kWh”) as “A” FROM “iotawatt” WHERE (“ct” = ‘Export’) AND \$timeFilter) , ( SELECT sum(“kWh”) as “B” FROM “iotawatt” WHERE (“ct” = ‘EandiskWh’) AND \$timeFilter) GROUP BY time(24h) fill(null)

i think i just found it (maybe): if i set “calculation” to Total and not Last, i’m getting the same results…but i have no idea why? and this does not work for the following, the SingleStat Math gives 74% (correct), but the new Stat gives 76%)

SELECT (100 * (mean(“C”) + mean(“A”)) / (mean(“C”) + mean(“B”))) FROM ( SELECT sum(“kWh”) as “A” FROM “iotawatt” WHERE (“ct” = ‘Export’) AND \$timeFilter) , ( SELECT sum(“kWh”) as “B” FROM “iotawatt” WHERE (“ct” = ‘Zon3FkWh’) AND \$timeFilter) , ( SELECT sum(“kWh”) as “C” FROM “iotawatt” WHERE (“ct” = ‘EandiskWh’) AND \$timeFilter) GROUP BY time(24h) fill(null)