15 minute average of electricity power and time shift

Hello!
I would like to create a graph with 15 minute average of my HomeAssistant/InfluxDB/Grafana Shelly3EM data of electricity power. I have a state MojElektro electricity app reference to compare with.
This is the code so far:
from(bucket: “homeassistant/autogen”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“entity_id”] == “power_a_b_c”)
|> filter(fn: (r) => r[“_measurement”] == “W”)
|> filter(fn: (r) => r[“_field”] == “value”)

Now I need to calculate 15 min average of data. Then I must time shift it for 15 minutes in advance to sync it with state app.
MojElektro app shows average of 2kW at 23.45.
Grafana app shows roughly the same kW at 23.30.
I am trying to use Flux in Grafana because of time difference in my measurements vs state measurements (probably NTS problem or data calculation difference).
I will attach screenshots for clarification.
Thank you in advance.

InfluxDB in Grafana:

This is the graph and Flux code in InfluxDB so far:

Hi, again.
I managed to create Flux code for Grafana for 15 minute average. It seems that time shift issue resolved by itself.

from(bucket: “homeassistant/autogen”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “W”)
|> filter(fn: (r) => r[“entity_id”] == “power_a_b_c”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> aggregateWindow(every: 15m, fn: mean, createEmpty: false)
|> yield(name: “mean”)