Get diference between time range on ever-increasing value

Hi, I’m having difficulty figuring this one…

I have an ever-increasing value (Kwh) stored and I want to know by how much it increased in 7/14/30 days. I currently have 20-ish days of data stored.

this is my current query and it seems to work for 7d, but not for 14 or 30. What aggregator/selector am I suppose to choose for this?

I’m getting the time using the group by in the query, is this okay or should I use the relative time instead?

Thanks for the help.