Percent with max of last 3 days

Hey there,

i want to get the percentage with the max from last 3 days. Really dont know how to explain this better.

something like

SELECT (“value”[now]) * 100 / max(“value”[3d])

i’ve seen somewhere that setting the timerange for seperate values is possible, but maybe this was for prometheus. When i set group by time it is set for both values, but i just want the max from the last 3 days and the current or last value. I cant use nested query because there is only one group by time possible.

Any ideas?

Thanks in advance

are you on Influxdb 2.0+ ? i can help you to do that with Flux query

Hey, thank you for your quick response.
Influxdb 1.

Some more background: I try to visualize the percentage water loss for my plants. They have moisture sensors. But because of rootzone growing and water holding capacity of the soil is growing too, the max moisture is growing aswell. I want to “equalize” the different moisture sensors. Some show max 50%, some max 90%. If i could see when they drank 50% from last watering this would be great.

So i need the max value from lets say the last 3 days but the actual value to calculate new 100% and the actual value in percent