Total value per time period

I am using Timestream data source where I have a table with energy consumption per every 5 seconds. I am trying a query to get the sum of energy consumtion grouped by hour.
When querying the data in Timestream console I get the expected result, but when trying to replicate the same query in Grafana, it is correct for all the values except for the last one. As it gets a new value it deletes the last one. So the consumption for the oldest “group time” diminishes every time the newest “group time” gets a new data. As shown in the pictures below:
issue1 issue2
The last one starts in 7.9 and 20 mins later is in 4.9 and the first one starts in 0 and currently is in 6.4.