Problem visualizing decimals in Grafana Table

I have a very easy table with one time field and one numeric field.
The data source is MS SQL Server.
The query is:

SELECT
$__timeEpoch([Time]),
CAST(D.[ValueInt] as float)/10 as Val
FROM
[HPF].[dbo].[CycleData] AS D
WHERE
Time = (Select MAX(Time) FROM CycleData) AND
D.VariableName = ‘Var_ActualPressure’

The ValueInt field is an int with value 1541, but they are decimals, so I would show 154.1.
If I run the generated SQL with SQL server is correctly displays “154.1”
In a Grafana table this query only displays me “154”
If I substitute in Grafana “/10” with “/100” it shows me “15.4”, so it does not seem a “number of decimals” problem.
I have tried to raise the “standard options → decimal” to 2 but to no avail.

Thank you very much

1 Like

Hi @matteodt

Can you share your raw query from the inspect drawer inside the panel dropdown? I’d be interested to see the raw response from the sql server

1 Like

Sorry for the delay,
The raw query is the following:

SELECT
DATEDIFF(second, ‘1970-01-01’, [Time]) AS time,
CAST(D.[ValueInt] as float)/10 as Val
FROM
[HPF].[dbo].[CycleData] AS D
WHERE
Time = (Select MAX(Time) FROM CycleData) AND
D.VariableName = ‘Var_ActualPressure’

And the value of 131.7al is correct, 131.7

On Grafana is “131”.

thanks for the awesome information.

This topic was automatically closed after 365 days. New replies are no longer allowed.