I presume that you are using InfluxQL (not SQL, which is only avaialble in InfluxDB Cloud / 3.0).
I think the spread function should work because you have an ever increasing value and add a GROUP BY time() clause.
Overall query should resemble this:
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>),[tag_key] [fill(<fill_option>)]
Here is a potentially helpful thread: Daily consumption for one day is showing one day after