Gauge with instantaneous power from Energy Consumption

So I have an InfluxDB with values of energy consumption of an EV charger. These values are obtained from a power meter that outputs a pulse every 1Wh consumed.
With this data I created a graph that shows the energy consumed vs time:

To do that I simply used a SELECT sum()

Now I want to display with a Gauge the instantenous power averaged in a 15s interval.
For that I would simply need to get the last 15s of data and multiply it by 0,24:

The problem is that I can’t find the way for Grafana to obtain the last 15s of data from the database:
Is this an option?

This is the Gauge configuration so far: