I have some consumption data coming in from InfluxDB cloud which is simply a (ever) growing value representing energy use. I’m looking to create a dashboard that can compare what was used say yesterday with today (or last week / current week) etc etc, but can’t figure out how to do it.
It would also be nice if I could aggregate the data so I can show a 7 day chart at 30min intervals.
Can you share a simple query of your data in order to get a look at what you have named your fields, measurement, etc?
For example, to compare the last (max) value from today vs yesterday, assuming your table is named readings with columns timestamp (of type timestamp ) and value (of type numeric ), perhaps something like this:
SELECT
DATE_TRUNC('day', timestamp) AS date,
MAX(value) AS value
FROM readings
WHERE timestamp >= DATE_TRUNC('day', CURRENT_TIMESTAMP)
GROUP BY date
ORDER BY date DESC
LIMIT 2;