-
Grafana version: 10.4.7
-
Apply different time ranges to different timestamp columns (e.g. gate1_ts and gate2_ts). My sample data looks like (tag is getting read at different gates):
|tag | gate1_ts | gate2_ts | gate3_ts |
|— | — | — | — |
|tag_1 | 2024-09-15 10:35:30 | 2024-09-15 13:55:10 | 2024-09-15 19:20:50|
|tag_1 | 2024-09-13 14:15:30 | 2024-09-13 15:25:10 | 2024-09-13 18:30:50|
|tag_2 | 2024-09-13 14:05:30 | 2024-09-13 16:45:10 | 2024-09-13 17:50:50|
For applying a time range to one timestamp column (gate1_ts) I can use panel global time filter and write my query something like this:
select * from table1 where $__timeFilter(gate1_ts)
I can use following query to add time range for second timestamp column (gate2_ts):
select * from table1 where $__timeFilter(gate1_ts) and $__timeFilter(gate2_ts)
which constructs my query like:
select * from table1 WHERE gate1_ts BETWEEN '2024-09-13T13:29:59Z' AND '2024-09-13T16:59:58Z' and gate2_ts BETWEEN '2024-09-13T13:29:59Z' AND '2024-09-13T16:59:58Z
but it restricts me to use same time range for both columns, however, I want different time ranges for different columns (gate1_ts and gate2_ts).
I want my query to look like:
select * from table1 WHERE gate1_ts BETWEEN '2024-09-13T13:29:59Z' AND '2024-09-13T14:59:58Z' and gate2_ts BETWEEN '2024-09-13T16:29:59Z' AND '2024-09-13T17:59:58Z
I am aware about “relative time” and “time shift” options under query option but it doesn’t solve my problem as I don’t need fixed time intervals
Thanks in advance!