I’m trying to configure the dashboard so when i select the time range, a bar gauge will show the difference of the value between the timestamps. I’m am using a MS SQL database as datastorage. I already tried follow query:
SELECT
(SELECT Verbruik FROM GalvanoLijnen3 WHERE TimeStamp <= $__timeTo()::timestamp ORDER BY TimeStamp DESC LIMIT 1) -
(SELECT Verbruik FROM GalvanoLijnen3 WHERE TimeStamp >= $__timeFrom()::timestamp ORDER BY TimeStamp ASC LIMIT 1) AS VerbruikDifference
, but that gave an error. I’m wondering if i’m doing something wrong with the query, or if i should try to get the value by using the transformation tab.
Left image a visualisation and for example the gauge should then show the difference of value between 10 and 10:35.
The current code i’m using for the gauge is:
SELECT TimeStamp AS “time”, Verbruik FROM Monitoring.dbo.GalvanoLijnen3
Error message is as following: Status: 500. Message: db query error: sql: expected 1 arguments, got 0.
And yes for the filter only returns 1 value.
Kind regards
No “Verbruik” is the data saved with a TimeStamp. I’m to trying to program the query so when you select specific timestamp in Grafana, it will display the difference from Verbruik between those 2 timestamps
So your latest question is about a timestamp and not Verbruik the float data type? This seems to be a totally new question unrelated to the original question which was about subtracting 2 Verbruik values from 2 different time stamps
Hello,
I had incorrectly asked my last question. After some figuring out, I managed to visualise the value with the piece of code you had shown.
Thanks for the help.