For some days I’ve tried to set up a chart in Grafana, but I have duration field in Integer, but I’d like to convert to hh:mm:ss, because the formats proposed by Grafana is not good to visualization.
I have this query in SQL that works well:
SELECT
ACP_Version AS [Version],
SUM(Duration) AS TotalDuration,
– Converte TotalDuration de segundos para hh:mm:ss
RIGHT(‘0’ + CAST(SUM(Duration) / 3600 AS VARCHAR), 2) + ‘:’ +
RIGHT(‘0’ + CAST((SUM(Duration) % 3600) / 60 AS VARCHAR), 2) + ‘:’ +
RIGHT(‘0’ + CAST(SUM(Duration) % 60 AS VARCHAR), 2) AS DurationFormatted
FROM
PERF_BUNDLE.dbo.Perf_BatchInformation
WHERE
BatchDescr LIKE ‘%PERF_EOM%’
GROUP BY
ACP_Version
ORDER BY
ACP_Version;
The problem is in chart I could display correcty, because it’s just displayed integer instead of showing my conversion. Does someone how to overcome this configuration?