I am experiencing an issue with a SQL query used for a Metabase dashboard, where the graph is intended to display operational status percentages rounded to two decimal places. However, the graph consistently shows three decimal places instead of two.
Query Structure:
The query utilizes multiple UNION ALL blocks to calculate hours and percentages for different operational statuses (Operativo, Operativo Parcial, Sin Conexión, and Falla). Below is a sample section of the query:
SELECT
'Operativo' AS estado,
SUM(operativo) AS horas,
ROUND((SUM(operativo) / NULLIF(SUM(operativo) + SUM(operativo_parcial) + SUM(sin_conexion) + SUM(falla), 0)) * 100, 2) AS porcentaje,
3 AS orden
FROM
public.reporte_disponibilidad_2 AS r
JOIN
public.usuario_cliente_final AS ucf ON r.idcliente = ucf.iddestino
WHERE
ucf.idusuario = {{user_id}}
AND r.fecha >= {{fecha_inicio}}::date
AND r.fecha <= {{fecha_fin}}::date
Issue Detail:
The query is supposed to round the percentage calculations to two decimals as shown in the SQL statement using the ROUND function. Despite this, the dashboard graph displays these percentages with three decimal places. This discrepancy in decimal precision affects the readability and professional appearance of the dashboard.
Request for Assistance:
Can anyone provide insights on why Metabase is not respecting the specified decimal precision from the SQL query in the graph display? Are there additional settings in Metabase that control the rounding of numbers specifically for graph visualization that I might be overlooking?
Thank you in advance for any guidance or solutions!