Hi i recently moved from Metabase to Grafana and started to import all my PSQL queries accordingly. I have a simple query that show the count of active services in a time range. The query inspector tells me the query works
SELECT
DATE_TRUNC(‘day’, account.created_shot) AS time,
service.name,
COUNT(*) as service_on
FROM
account
LEFT JOIN
customer c ON c.id_account = account.id
RIGHT JOIN
property p ON p.id_customer = c.id
RIGHT JOIN
service ON service.id_property = p.id
WHERE
service.category = ‘test’
AND service.name IN ($pacchettotest)
AND account.created_shot BETWEEN ‘2023-11-19’ AND ‘2023-11-21’
GROUP BY
time, service.name
ORDER BY
time, service.name;
My issue is that when i go into a time series the graph (which is supposed to have 3 lines , one for each service.name) is very wonky
I cannot find the solution anywhere it just seems that Grafana doesn’t like to use service_name and just uses service_on for data (moreover even when using service_on it seems that for each day it just selects the last service.name in alphabethical order and pushes a line from his value to the highest one and resets each day.)
Can anyone help me? To specify i want my graph to show each service.name as a separate line and each line to follow the trend of the query.