Create a query similar to increase() in influxql in grafana

I have been trying a query like this in GRAFANA to get the sum of non-difference, which I think is the definition of increase()

I have tried something like:

SELECT sum("hmm") FROM (SELECT non_negative_difference(last("numMeasurements")) FROM "monitor"."database" WHERE ("database" = 'metrics') AND $timeFilter GROUP BY time(5m)) GROUP BY time($__interval)

However, it shows “no data”.
How can I achieve this query? Basically, I am trying to get the sum of the non-negative-differences over

Trying to emulate something similar to the increase() function present in influx 2.0 using influxql in influxdb 1.7.

How could this be achieved?