Math Between Queries?

Hello all,

I am using InfluxDB as my data source within Home Assistant, and I’m trying to compare two sets of data to each other. I have a ton of use-cases for this, which is why I want to understand how I can accomplish it. But one example I can give is my daily water use. I record how many grams of water I drink every day - one data point per day. What I want to be able to do is show a stat that will tell me the percent change of the average for this time period versus the last time period. For example, if my time period is set to 7 days, my stat would tell me how much my average water intake changed this week versus last week. If set to a year, it would tell me how much my average water intake changed between this year and last year. That way I can know whether my water intake is up from last (day, week, month, year) and by how much. I want to be able to apply this to many things, such as temperature, humidity, wind speed, calories eaten, power consumption, and many other things, but despite scouring the internet for answers I’ve come up short.

Is this even possible using InfluxDB? Thanks for your help in advance.

Hi @kackerlacka

I think you are describing some very common use cases for time series databases, and Grafana. The best place to ask this is probably the InfluxDB forum, where you could learn more about organizing this data and querying it to return your desired calculations.

Once that is all figured out, using global variables in Grafana and maybe perhaps transformations will help accomplish this goal…

This topic was automatically closed after 365 days. New replies are no longer allowed.