How can I query data per day, for the last 7 days, without hardcoding the start/end times?

Hi,

I’m running the latest Grafana (7.1.3). I am having multiple issues setting up a “daily summary” panel for my power monitoring system. I am using InfluxDB to store power production and consumption data for my house. I’m simply trying to build a panel that shows the total daily solar production for the last 7 days. It seems so trivial at first glance, but I have tried numerous times to get this right. My queries are returning two values with two different dates:

> SELECT integral("power") /3600000 FROM "solar" WHERE ("time" > now()-3d AND "time" < now()-2d) GROUP BY time(1d) TZ('US/Pacific')
name: solar
time                integral
----                --------
1596783600000000000 15.551632824032083
1596870000000000000 51.98187595234573

The 159678360000000 value represents 8/7/2020 12:00:00 AM.
The 159687000000000 value represents 8/8/2020 12:00:00 AM.

Since I ran the above query at 3:10PM, I suspect it is literally querying the date range from 3:10PM 3 days ago to 3:10PM 2 days ago.

How can I create a query, or set of queries, to return a single value per day for the past X days?

Thanks!