Display difference between 2 timestamps

164 Views Asked by At

I'm using PostgreSQL as Grafana's data source. In my database I have a record which contains JSON data:

{"start": "1695668520", "end": "1695810577"}

In my dashboard which is set as Stat I have 2 queries to get start and end values:

SELECT info->>'start' AS start_value
FROM public.metrics
WHERE PR = $PR;

and

SELECT info->>'end' AS end_value
FROM public.metrics
WHERE PR = $PR;

I've added transformation: Convert field type - both to numeric and Add field from calculation - Binary operation -> end_value - start_value -> alias: result. I thought result will be displayed in my dashboard, but it's not. I tried to add Overrides -> Field with name, but the result variable/field is not visible there. Am I doing something wrong? I just want to display in my dashboard only the result of these timestamps.

0

There are 0 best solutions below