Hi everyone, we are strugling to make this dashboard work. This is a dashboard, supported by a single query where the structure is AssetId, Tag, Timestamp, Value. We have two custom variables with multi-select, AssetID and Tag. The query runs fine but it was very diffiult to make this work in Timeseries dashboard.
Note: We tried Override functions but I we have to make multiple queries which would not be nice because the number of Assets and Tags selected by user can be dynamic.
Thank you.
Welcome to forum @rdagumampan
What is your datasource you are querying against? mysql?
Hi,
Source: Posgresql DB.
Variables:
- Asset: [A,B,C…], allows multiple
- Tag: [Sensor1, Sensor2, …] allows multiple
SELECT
tag,
asset_id,
$__time(event_timestamp_utc),
COALESCE(
value_float,
CAST(value_int AS DOUBLE PRECISION),
CAST(value_bit AS int)
) AS value
FROM iot_data
WHERE
tag IN (${Tag:sqlstring})
AND asset_id IN (${Asset:sqlstring})
AND $__timeFilter(event_timestamp_utc)
-
You will have to select either tag or asset_id as metric, I included both.
-
You also need to select Format as timeseries not table
SELECT
tag as metric,
asset_id as metric,
$__time(event_timestamp_utc) as [time],
COALESCE(
value_float,
CAST(value_int AS DOUBLE PRECISION),
CAST(value_bit AS int)
) AS value
FROM iot_data
WHERE
tag IN (${Tag:sqlstring})
AND asset_id IN (${Asset:sqlstring})
AND $__timeFilter(event_timestamp_utc)
order by 3
You are sent from stars! This works well. Small thing though, when I have more selections, the plot becomes DOTS instead of LINES. This even if the axiss definition is LINES
Tried with overrides and still its dotted.
Single asset, single tag
Seems to break when I have two+ assets
1 Like
you might need to change the number of sampling or the time slots to be a bit wider, right now you have every 5 seconds, it’s going to be crowded and packed
using $__timeGroupAlias(event_timestamp_utc, '30s')
type of thing

Works like magic! Thanks all who contributed to this conversation 
1 Like