i use Grafana 9.x and i want to subtract the times withe each other. I get a datapoint every 15 minute and with those datas i want to calculate the power of the machine for that i need the difference of the time. Is it possible to subtract the time with the time before (t_n - t_n-1) and the result save in a row/variable or column?
I don’t understand. I can’t share that data source. The data there is from my work. But my question is a general one. I just want to know if it is possible to access the times in which the data arrives at InfluxDB. I have the code in Grafana already so far that it shows me the time and date of the data when they were sent. Now I want to calculate the difference of the time of the last and penultimate record via the map() function or another and I want to save this difference as a variable so that I can use it for various calculations.
I believe that in order to do something like the above, the map() function will not work since your calculation would be spanning more than 1 record. Maybe the reduce() function (which I am not super familiar with). More here.
Thank you! This is what i was looking for, but the porblem is the reduce()-function make a multiple table to a one row table. Is it possible that i safe the value after every step in a new column? I mean, iwant to safe the result between the steps.
Just to clarify, do you want to know the difference in the time between consecutive readings (in which case elapsed() would probably be the right choice) or the difference in the values (in which case difference() would probably be the function to use)?